JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css">
<div id="slider-container"></div>
<p>
<label for="amount">Price range:</label>
<input type="text" id="amount" style="border: 0; color: #f6931f; font-weight: bold;" />
</p>
<div id="computers">
<div class="system" data-price="299">div1 - 299</div>
<div class="system" data-price="599">div2 - 599</div>
<div class="system" data-price="1099">div3 - 1099</div>
</div>
<div id="slider-range"></div>
CSS
#slider-container{
width:350px;
margin-left:30px;
}
JavaScript
$(function() {
$('#slider-container').slider({
range: true,
min: 299,
max: 1099,
values: [299, 1099],
slide: function(event, ui) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
var mi = ui.values[ 0 ];
var mx = ui.values[ 1 ];
filterSystem(mi, mx);
}
});
$( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + $( "#slider-range" ).slider( "values", 1 ) );
});
function filterSystem(minPrice, maxPrice) {
$("#computers div.system").hide().filter(function() {
var price = parseInt($(this).data("price"), 10);
return price >= minPrice && price <= maxPrice;
}).show();
}