migajek
migajek

Reputation: 8614

jQuery draggable: access the being-dragged element on drag start

I need to modify the element when as soon as it starts being dragged. The 'start' callback takes two arguments, only the first of them seems to be usable for me. The deal is that I'm using helper: 'clone' which makes event.originalTarget to point only the "original" element, not the new one (which is in fact the one being dragged). Any solutions? Thanks, m.

Upvotes: 3

Views: 1226

Answers (1)

MvanGeest
MvanGeest

Reputation: 9661

Isn't ui.helper what you need? From the docs:

ui.helper - the jQuery object representing the helper that's being dragged

So you'll have something like

$( ".selector" ).draggable({
   start: function(event, ui) {
      ui.helper.modify(the_way_I_want_to_modify_it);
   }
});

Upvotes: 2

Related Questions