[英]How to disable dragging feature in my case?
I want to stop the dragging
feature inside a draggable
method. 我想停止
draggable
方法中的dragging
功能。
$('#dragitem').draggable({
scroll : false,
drag: function(event, ui){
//a if statement
if(….){
//I want to stop the dragging here.
}
}
});
Is there a way to stop the dragging
inside the drag function? 有没有办法停止
dragging
拖动功能里面? Thanks for the help! 谢谢您的帮助!
尝试:
$("#dragitem").draggable({ disabled: true });
Try this: 尝试这个:
$('#dragitem').draggable({
scroll : false,
drag: function(event, ui){
//a if statement
if(….){
//I want to stop the dragging here.
event.preventDefault();
}
}
});
I've been in this situation before and I've triggered mouseup
event here for lack of a better solution: 我以前曾遇到这种情况,但由于缺少更好的解决方案而在这里触发了
mouseup
事件:
drag: function(event, ui){
if(true) {
// stop dragging
$(document).trigger('mouseup');
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.