[英]JQuery droppable out event is not fired sometimes draggable with cursorAt
Sometimes JQuery droppable out event not fired when draggable has param cursorAd (before start dragging draggable moves out of droppable to set cursor position like in cursorAd). 有时候,当draggable有param cursorAd时(在开始拖动draggable移出droppable以设置游标位置之前的游标位置之前),JQuery droppable out事件不会被触发。
For example (try to drag it by right bottom corner): 例如(尝试将其拖到右下角):
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="jquery.min-1.5.0.js"></script>
<script type="text/javascript" src="jquery-ui.min-1.8.9.js"></script>
</head>
<body>
<div id="dg1" style="z-index:1;border:1px solid red;width:100px;height:50px;position:absolute;">draggable</div>
<div id="dp1" style="border:1px solid green;width:100px;height:50px;position:absolute; top:100px;left:100px;">droppable</div>
<script>
$(document).ready(function(){
$('#dg1').draggable({
cursorAt:{
left:20,
top:20
}
});
$('#dp1').droppable({
drop:function(){
console.log('drop event');
},
out:function(){
console.log('out event');
}
});
});
</script>
</body>
</html>
Please help me to resolve this problem 请帮我解决这个问题
Just add tolerance touch
to droppable 只需为droppable添加公差
touch
即可
tolerance:"touch"
By default
tolerance
is set tointersect
默认情况下,
tolerance
设置为intersect
"intersect" : Draggable overlaps the droppable at least 50% in both directions.
“intersect” : Draggable在两个方向上重叠至少50%的droppable。
We need to make it
touch
as per you requirement.我们需要根据您的要求进行
touch
。"touch" : Draggable overlaps the droppable any amount.
“touch” :可拖动任意数量的可拖放重叠。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.