jQuery-UI draggable cloning - Does the start handler receive any reference to the element being cloned? -
say i'm cloning element div_1.
in draggable's start event handler, need select every element except div_1.
i sense there's no direct way that, plan select every element, loop through them , eliminate 1 that's origin of clone.
but without way reference div_1 draggable start, have nil compare selected elements to. , id isn't cloned can't utilize that.
(this enable multidragging/multicloning custom behavior. without filtering, when clone every selected element clone 1 cloned.)
(my backup plan implement cloning on own , bypass draggable's cloning, in case there won't duplicate clones running around causing problems.)
ah, figured out.
first, "event" parameter includes @ to the lowest degree 3 useful properties: target, currenttarget, , else. looping through properties , spitting out target ones until find objects show them. refer original element, according "id" property.
so "event.currenttarget.id" or such.
but wasn't necessary.
i using existing code comparing "$(ui.helper).attr('id')" '$(this).attr("id")' within "each" handler within start. obviously, "this" in scope refers different "this" within parent scope of start handler.
so when switched code on cloning mode, missed connection , got confused.
$(this).attr("id") in opening of start handler, during clone, provide origin's id, rather $(ui.helper).attr("id"), provides clone's id.
i obtained value , used within "each" handler , worked perfectly.
thanks!
jquery jquery-ui clone draggable
No comments:
Post a Comment