[英]ondragenter do not affect children
Is there any way to do not fire the ondragleave
event when dragging hover a children?有什么方法可以在拖动 hover 一个孩子时不触发
ondragleave
事件?
<div ondragenter="entered()" ondragleave="left()">
<a href="#">children element</a>
</div>
Here an example: http://jsfiddle.net/6uu7h/4/ (Chrome)这里是一个例子: http://jsfiddle.net/6uu7h/4/ (Chrome)
I do not want that when entering the children it fires the event ondragleave
since it did not really left the element.我不希望在进入子元素时触发事件
ondragleave
,因为它并没有真正离开元素。
Here an example: http://jsbin.com/ahipas/4/edit这里是一个例子: http://jsbin.com/ahipas/4/edit
$(function() {
var destination;
$('#bidi').on('dragenter', function(event) {
destination = event.target;
$('#debug').append("ENTERED ELEMENT<br />");
});
$('#bidi').on('dragleave', function(event) {
if (!$(this).find(destination).size() && !$(this).find(event.target).size()) {
$('#debug').append("LEFT ELEMENT<br />");
}
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.