简体   繁体   中英

ondragenter do not affect children

Is there any way to do not fire the ondragleave event when dragging hover a children?

<div ondragenter="entered()" ondragleave="left()">
    <a href="#">children element</a>
</div>

Here an example: 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.

Here an example: 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 />");
    }
  });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM