有时,当draggable具有参数cursorAd时,JQuery droppable out事件不会触发(在开始拖动之前,draggable会移出droppable以设置光标位置,就像在cursorAd中一样)。
例如(尝试将其拖动到右下角):
<!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>请帮我解决这个问题
发布于 2016-08-19 20:13:47
只需将容差touch添加到droppable
tolerance:"touch"缺省情况下,
tolerance设置为intersect
“intersect”Draggable :Draggable在两个方向上与droppable重叠至少50%。
我们需要使它的touch根据您的要求。
“触摸”:Draggable可以覆盖droppable的任意数量。
https://stackoverflow.com/questions/39038680
复制相似问题