【发布时间】:2016-08-19 12:05:23
【问题描述】:
当 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>
请帮我解决这个问题
【问题讨论】:
标签: javascript jquery jquery-ui draggable droppable