[英]How to disable dragging feature in my case?
我想停止draggable
方法中的dragging
功能。
$('#dragitem').draggable({
scroll : false,
drag: function(event, ui){
//a if statement
if(….){
//I want to stop the dragging here.
}
}
});
有沒有辦法停止dragging
拖動功能里面? 謝謝您的幫助!
嘗試:
$("#dragitem").draggable({ disabled: true });
嘗試這個:
$('#dragitem').draggable({
scroll : false,
drag: function(event, ui){
//a if statement
if(….){
//I want to stop the dragging here.
event.preventDefault();
}
}
});
我以前曾遇到這種情況,但由於缺少更好的解決方案而在這里觸發了mouseup
事件:
drag: function(event, ui){
if(true) {
// stop dragging
$(document).trigger('mouseup');
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.