jQuery Slider Step Attribute Not Working
Here is the code I am using to create my slider:
$(".slider").slider({
steps: 10,
animate: true,
range: true,
min: 0,
max: 500,
values: [range[0],range[1]],
chan开发者_如何学Pythonge: function() {
range = $( ".slider" ).slider("option", "values");
$("#low-price").text("Min: $"+range[0]);
$("#high-price").text("Max: $"+range[1]);
}
});
The problem is that the step attribute does not function properly. With the above code I would think that each slide would change the value by 10, but it is stepping 1 value at a time. Any ideas on what is wrong here?
The problem is the option name, it should be step
not steps
, like this:
$(".slider").slider({
step: 10, //step, singular
animate: true,
range: true,
min: 0,
max: 500,
values: [range[0],range[1]],
change: function() {
range = $( ".slider" ).slider("option", "values");
$("#low-price").text("Min: $"+range[0]);
$("#high-price").text("Max: $"+range[1]);
}
});
I believe the option should be step rather than steps.
It should be:
step: 10
(a.k.a. not plural)
精彩评论