我正在使用jQuery滑块,在其Slide事件中,我编写了一些要执行的代码。
它仅在我缓慢滚动滑块时运行,而当使用鼠标快速滚动滑块时,slide事件中的代码将不会执行。
这是我的代码:
$( "#master" ).slider({
value: 0,
orientation: "horizontal",
range: "min",
step:1,
animate: false,
slide: function( event, ui ) {
/*the below will not execute when slider scrolled faster */
$( "#ratvalue" ).val( ui.value+"%" );
var ratval=ui.value;
console.log(ratval);
progNew("#master", ratval, 100);
}
});
用这个:
$( "#master" ).slider({
value: 0,
orientation: "horizontal",
range: "min",
step:1,
animate: false,
stop: function( event, ui ) {
/*the below will work */
$( "#ratvalue" ).val( ui.value+"%" );
var ratval=ui.value;
console.log(ratval);
progNew("#master", ratval, 100);
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句