"Bootstrap Pricing Slider"
Bootstrap 3.3.0 Snippet by paypeer

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="price-box"> <form > <div class="price-slider"> <h4 class="great">Amount</h4> <span>Minimum £50,000</span> <div class="col-sm-12"> <div id="slider"></div> </div> </div> <div class="price-slider"> <h4 class="great">Estate Agent's Fee Percentage'</h4> <span>between 0.5% to 3%</span> <div class="col-sm-12"> <div id="slider2"></div> </div> </div> <div class="form-group"> <label for="amount" class="col-sm-6 control-label">Amount (£): </label> <span class="help-text">Please choose your amount</span> <div class="col-sm-6"> <input type="hidden" id="amount" class="form-control"> <p class="price lead" id="amount-label"></p> <span class="price">.00</span> </div> </div> </form> </div> </div> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
.ui-widget-content { border: 1px solid #bdc3c7; background: #e1e1e1; color: #222222; margin-top: 4px; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 5.2em; height: 2.2em; cursor: default; margin: 0 -40px auto !important; text-align: center; line-height: 30px; color: #FFFFFF; font-size: 15px; } .ui-slider .ui-slider-handle .glyphicon { color: #FFFFFF; margin: 0 3px; font-size: 11px; opacity: 0.5; } .ui-corner-all { border-radius: 20px; } .ui-slider-horizontal .ui-slider-handle { top: -.9em; } .ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #f9f9f9; background: #3498db; } .ui-slider-horizontal .ui-slider-handle { margin-left: -0.5em; } .ui-slider .ui-slider-handle { cursor: pointer; } .ui-slider a, .ui-slider a:focus { cursor: pointer; outline: none; } .price, .lead p { font-weight: 600; font-size: 32px; display: inline-block; line-height: 60px; } .price-slider { margin-bottom: 70px; } .price-slider span { font-weight: 200; display: inline-block; color: #7f8c8d; font-size: 13px; } .ui-slider-range-min { background: #2980b9; }
$(document).ready(function() { $("#slider").slider({ animate: true, value:1, min: 30, max: 1500, step: 30, slide: function(event, ui) { update(1,ui.value); //changed } }); $("#slider2").slider({ animate: true, value:0, min: 1, max: 7, step: 1, slide: function(event, ui) { update(2,ui.value); //changed } }); //Added, set initial value. $("#amount").val(30); $("#duration").val(1); $("#amount-label").text(0); $("#duration-label").text(0); update(); }); //changed. now with parameter function update(slider,val) { //changed. Now, directly take value from ui.value. if not set (initial, will use current value.) var $amount = slider == 1?val:$("#amount").val(); var $duration = slider == 2?val:$("#duration").val(); /* commented $amount = $( "#slider" ).slider( "value" ); $duration = $( "#slider2" ).slider( "value" ); */ $total = "$" + ($amount * $duration); $( "#amount" ).val($amount); $( "#amount-label" ).text($amount); $( "#duration" ).val($duration); $( "#duration-label" ).text($duration); $( "#total" ).val($total); $( "#total-label" ).text($total); $('#slider a').html('<label><span class="glyphicon glyphicon-chevron-left"></span> '+$amount+' <span class="glyphicon glyphicon-chevron-right"></span></label>'); $('#slider2 a').html('<label><span class="glyphicon glyphicon-chevron-left"></span> '+$duration+' <span class="glyphicon glyphicon-chevron-right"></span></label>'); }

Related: See More


Questions / Comments: