Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dragover - is there a drag out?

Tags:

jquery

I have the following for drag over:

$(window).on('dragover', this.onDragOver);

Is there a drag out or something similar, I need to fire an event for when the user moves off the window.

like image 989
panthro Avatar asked May 21 '14 17:05

panthro


People also ask

What is ondragover?

Definition and Usage. The ondragover event occurs when a draggable element or text selection is being dragged over a valid drop target. By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element. This is done by calling the event.

What is a valid drop target?

If the mouse is released over an element that is a valid drop target, that is, one that cancelled the last dragenter or dragover event, then the drop will be successful, and a drop event will fire at the target. Otherwise, the drag operation is cancelled, and no drop event is fired.

What is drag leave?

Occurs when an object is dragged out of the control's bounds. public: event EventHandler ^ DragLeave; C# Copy.


3 Answers

It sounds like you're looking for the dragleave event. From the docs:

The dragleave event is fired when a dragged element or text selection leaves a valid drop target.

like image 185
Dan Hlavenka Avatar answered Oct 16 '22 00:10

Dan Hlavenka


I would try one of these two events:

focus out http://api.jquery.com/focusout/

or

mouse leave http://api.jquery.com/mouseleave/

like image 25
deme72 Avatar answered Oct 16 '22 00:10

deme72


There is a dragleave event, but it's more like the opposite of dragenter

like image 25
Maurice Perry Avatar answered Oct 16 '22 00:10

Maurice Perry