Ray
Ray

Reputation:

How can I tell if an element is being dragged using jQuery?

How can I check if an element is being hovered over and/or clicked on and/or dragged? I need this info so I can stop infinite loops for the duration of the drag.

Upvotes: 0

Views: 3143

Answers (1)

kbosak
kbosak

Reputation: 2130

You can use jQuery UI's Draggables feature. It allows you to set a callback function for when the drag starts. Documentation is at http://jqueryui.com/demos/draggable/#event-start. It also has a callback for during a drag.

You can already set callback functions for hover and click via jQuery's click() and mouseover() events. http://docs.jquery.com/Events

Upvotes: 3

Related Questions