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).
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:
$(".myselector").draggable(
{
revert: function(droppableObj)
{
//if false then no socket object drop occurred.
if(droppableObj === false)
{
//revert the .myselector object by returning true
return true;
}
else
{
//droppableObj was returned,
//we can perform additional checks here if we like
//alert(droppableObj.attr('id')); would work fine
//return false so that the .myselector object does not revert
return false;
}
}
});
See http://www.agilepro.com/blog/2009/12/while-this-functionality-is-built-into.html for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With