JavaScript mouseUp event ignored when mouse is released during drag
$j(divID).bind('dragstart', function (event) { event.preventDefault() });
Thanks all
90% of the time, this is because the dragged element is in front of the element with the mouseup
event listener, so the parent element underneath never gets the event.
Usually, this can be fixed by using addEventListener
as opposed to the inline form of the event. Another way to fix this is to give the dragged element an eventListener
for when the mouse is released. Also, you can have a div
that is put in front of all other elements whenever an element starts to drag (via the zIndex
property).
Edit: I whipped up some proof-of-concept code: http://jsfiddle.net/2BkEM/5/