Determine what is being dragged from dragenter & dragover events

前端 未结 9 1959
梦毁少年i
梦毁少年i 2020-12-04 17:35

I\'m trying to use the HTML5 draggable API (though I realize it has its problems). So far, the only showstopper I\'ve encountered is that I can\'t figure out a way to determ

9条回答
  •  执念已碎
    2020-12-04 17:46

    I think you can get it by calling e.relatedTarget See: http://help.dottoro.com/ljogqtqm.php

    OK, I tried e.target.previousElementSibling and it works, sorta.... http://jsfiddle.net/Gz8Qw/4/ I think it hangs up because the event is being fired twice. Once for the div and once for the text node (when it fires for text node, it is undefined). Not sure if that will get you where you want to be or not...

提交回复
热议问题