简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM