Is there a way to get information if an element that's draggable is reverted?
I'm stuck on this. I want to make an element droppable again, but only if the draggable that was lying there is moved elsewhere (meaning doesn't revert).
Is there a way to get information if an element that's draggable is reverted?
I'm stuck on this. I want to make an element droppable again, but only if the draggable that was lying there is moved elsewhere (meaning doesn't revert).
Expanding on @mbeedub's solution, here's my own solution. In my case, I need the value of
ui.position
onstop
. If the drag is reverted, then I need to return the object to its original position. Unfortunately, jQuery UI does not update theposition
property after the revert animation is run. Fortunately, there is anoriginalPosition
property. So as long as I can detect reverted state (in this case, via classname), I'm ok!I found out that there is away to get information about whether an object has reverted or not. It's built into jQuery but not that well documented apparently.
Essentially it's done via using a callback function for the revert option of a draggable object.
Something like the following:
See http://www.agilepro.com/blog/2009/12/while-this-functionality-is-built-into.html for more details.
Doesn't looks like jQuery UI has support for it so you could add it yourself like this:
Would allow you to do this: