0

I want to trigger the stop() event which is generated when using jQuery UI draggable. All elements are dynamically generated. In the project I am working on, all stop() events do the same thing, they change the calling object's appearance relative to other surrounding, snapped draggables. But the other draggables have to change -as well-. So calling every draggables' stop event is like refreshing them, so that they redraw themselves, so to speak. The problem is pretty basic, and I tried to read up on it, but I couldn't figure it out.

For a quick insight on what I want to do, check out this fiddle, I put a comment right where I want that manually triggered call of stop(): http://jsfiddle.net/VCDG4/1/

In the fiddle, you have to click the button first because I need the draggables to be generated dynamically.

What doesn't work is this:

$('#Id_of_the_other_draggable').trigger('stop');

Finding out the Id of the other draggable is not the problem, but the stop() event does not fire like that.

I need that triggered call because I need the event object which is generated when stop(event ui) is called; it comes with information that I need.

I already checked this thread Jquery .trigger('stop') method for .draggable. But here, they register a new event via bind() called "dragstop" which is getting called nicely, I tried that. BUT I don't get the event object with the information I need.

Any help is much appreciated. Thx

Community
  • 1
  • 1

1 Answers1

0

see http://jsfiddle.net/VCDG4/4/

added

$('div.drag')

instead of

$(this)
Kevin van Hoorn
  • 131
  • 1
  • 7
  • thanks man! But you selected it via the .drag class, which does not trigger the stop() event. It is a regular jQuery selector. Check my update and activate your console, you should get a console output every time you move any of the two divs. but with that div.drag selector, it is only fired with the one div which has the console.log(...) code line in its stop callback. http://jsfiddle.net/VCDG4/5/ – user2627480 Aug 12 '13 at 14:37