当我单击滑块的手柄并拖动它时,它将被禁用但仍会滑动。禁用的功能有什么问题?
这是我的代码:
$(function() {
var prevValue=100;
$( "#slider" ).slider({
value:100,
min: 0,
max: 500,
step: 50,
disabled: false,
slide: function( event, ui ) {
$( "#slider" ).slider( "option", "disabled", true );
setTimeout(function(){
$( "#slider" ).slider( "option", "disabled", false );
},2000);
if (prevValue>ui.value){
ui.value= prevValue-50;
}else{
ui.value= prevValue+50;
}
prevValue=ui.value;
$( "#zomlevel" ).val( "$" + ui.value );
$( "#slider" ).slider( "option", "value", prevValue );
$('#slider').trigger(e);
}
});
$( "#zomlevel" ).val($( "#slider" ).slider( "value" ) );
});
但是当我单击滑块然后释放时,它将被禁用。如何在单击和拖动时使其完全禁用。
这是一个jsfiddle:http: //jsfiddle.net/endl3ss/jNwww/24/