Page 1 of 1

Remove makeDraggable

PostPosted: Tue Mar 02, 2010 2:32 pm
by Lo3ty
Hi

I'am Referring to this topic:
general12/clear-delete-makedraggable-function-element-t2026.html

I have a function which makes an element (given as parameter) draggable.

But to prevent that one Element gets more than one Drag instance, I want to delete all the Drag instances before adding a new one.

How is it possible to delete the Drag instance from outside the function? In my case in another function.

My code:
  1.  
  2. function remove(el)
  3. {
  4. //REMOVE DRAG INSTANCE
  5. }
  6.  
  7. function make_draggable(el)
  8. {
  9. el.makeDraggable({..............a lot of options});
  10. }
  11.  
  12. function run(el)
  13. {
  14. remove(el);
  15. //Here is an AJAX request executed
  16. make_draggable(el)
  17. }
  18.  


I tried to explain myproblem as easy as possible because the drag script is part of an very difficult calendar.

Leonhard

Re: Remove makeDraggable

PostPosted: Sat Mar 13, 2010 2:29 pm
by rollbich
hi !

I don't get the problem very well. What's the problem with your code.
You call the remove function in your run function. It should work if your remove function is OK
To remove all drag instances, you have to call the stop function as mentioned in the mootools doc.