我想动态修改滑块.我试图通过使用
$("#slider").slider("option", "values", [50,80]);
This call will set the values, but the element will not update the slider positions. Calling
$("#slider").trigger('change');
does not help either.
是否有其他/更好的方法来修改值和滑块位置?
我想动态修改滑块.我试图通过使用
$("#slider").slider("option", "values", [50,80]);
This call will set the values, but the element will not update the slider positions. Calling
$("#slider").trigger('change');
does not help either.
是否有其他/更好的方法来修改值和滑块位置?
这取决于您是要更改当前范围内的滑块还是要更改滑块的范围.
如果要更改的是当前范围内的值,则.slider()方法是您应该使用的方法,但语法与您使用的有点不同:
$("#slider").slider('value',50);
or if you have a slider with two handles it would be:
$("#slider").slider('values',0,50); // sets first handle (index 0) to 50
$("#slider").slider('values',1,80); // sets second handle (index 1) to 80
如果它是您要更改的范围,则为:
$("#slider").slider('option',{min: 0, max: 500});