是否可以将自定义幻灯片过滤器添加到wordpress数据表中 喜欢这段代码吗?
function showProducts(minP, maxP, minQ, maxQ) {
$("#products li").filter(function() {
var price = parseInt($(this).data("price"), 10);
var quality = parseInt($(this).data("quality"), 10);
if(price >= minP && price <= maxP && quality >= minQ && quality <= maxQ){
$(this).show();
} else {
$(this).hide();
}
});
}
$(function() {
var options = {
range: true,
min: 0,
max: 250,
values: [0, 250],
slide: function(event, ui) {
if(event.target.id = "price"){
var minP = ui.values[0],
maxP = ui.values[1],
minQ = $("#quality").slider("values", 0),
maxQ = $("#quality").slider("values", 1);
}
if(event.target.id = "quality"){
var minP = $("#price").slider("values", 0),
maxP = $("#price").slider("values", 1),
minQ = ui.values[0],
maxQ = ui.values[1];
}
alert(minP +", "+ maxP +", "+ minQ +", "+ maxQ);
showProducts(minP, maxP, minQ, maxQ);
}
};
$("#price").slider(options);
$("#quality").slider(options);
});