这是使用此脚本的范围滑块http://www.eyecon.ro/bootstrap-slider我已经设置了JSbin http://jsbin.com/xelas/1/edit?html,css,js,output#C :L20完整,因为有很多代码
我找不到此脚本的任何问题,因为该脚本最初正在运行,并且由于某种原因它无法运行,并且根本没有错误消息。
jQuery(document).ready(function ($) {
$("#priceslider").sdcslider({
range: true,
orientation: 'horizontal',
min: 170000,
max: 500000,
step: 10000,
tooltip: 'hide',
value: [170000, 500000]
});
$("#pricerange").text("$170.000 - $500.000");
$("#priceslider").on('slide', function (slideEvt) {
//console.log(slideEvt);
$("#pricerange").text("$" + slideEvt.value[0] + " - $" + slideEvt.value[1]);
var mi = slideEvt.value[0];
var mx = slideEvt.value[1];
filterPropertyPrice(mi, mx);
});
function filterPropertyPrice(minPrice, maxPrice) {
$(".property").filter(function () {
var price = parseInt($(this).data("price"));
return price >= minPrice && price <= maxPrice;
}).show();
}
});
<h4> Price Range: <span id="pricerange"></span></h4>
<input id="priceslider" class="sdcslider" type="text">
<div class="property" data-bedroom="3" data-price="300000">Property One</div>
<div class="property" data-bedroom="3" data-price="400000">Property Two</div>
<div class="property" data-bedroom="3" data-price="450000">Property Three</div>
<div class="property" data-bedroom="3" data-price="350000">Property Four</div>
<div class="property" data-bedroom="3" data-price="500000">Property Five</div>
感谢和问候说
你要先藏起来
function filterPropertyPrice(minPrice, maxPrice) {
$(".property") // select all the properties
.hide() // hide all of them
.filter(function () { // filter the ones that match the price
var price = parseInt($(this).data("price"));
return price >= minPrice && price <= maxPrice;
}).show(); // show only the filtered ones
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句