Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Destroy JQuery draggable

I have a set of elements that are draggable. How can I remove draggable function?

  1. $('.draggable').draggable('disable') is not an option in my case

  2. $('.draggable').draggable('destroy') returns Uncaught TypeError: Cannot read property 'options' of undefined

like image 397
ab.helly Avatar asked Mar 21 '13 15:03

ab.helly


1 Answers

From the jQuery UI API:

destroy()

Removes the draggable functionality completely. This will return the element back to its pre-init state.

This method does not accept any arguments.

Code examples:

Invoke the destroy method:

$( ".selector" ).draggable( "destroy" );

EDIT

As this seems to not work properly for you - and it's an issue being seen all around the jQuery forums - that's a proposed fix:

ui.draggable.draggable("option", "revert", false);
like image 121
melancia Avatar answered Sep 25 '22 02:09

melancia