javascript - HTML 5 drag events: 'dragleave' fired after 'dragenter' -
i'm using html5 dragevents in single page application.
currently, i'm listening dragleave
, dragenter
events set proper classes on elements.
but, when 2 valid target elements(a , b) next each other, , drag elment through b, events fired in following sequance.
+--------------+-------------+ | | | +-------+ | | b | | | | | | | elem +------------------------------------> | | | | | | +-------+ | | | +--------------+-------------+
dragenter
of adragenter
of bdragleave
of a
the expected order of events be,
dragenter
of adragleave
of adragenter
of b
i assumed order since item has leave a
before entering b
. missing here? there rationale dragenter
being fired before dragleave
? there way change behaviour?
i have jsfiddle here.
the code pretty simple dragenter
, dragover
being listened to.
dragenter: function(e) { console.log("basket dragenter"); // logic here }, dragleave: function(e) { console.log("basket dragleave"); // logic here },
Comments
Post a Comment