Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#6179 closed bug (worksforme)

Deleting draggable div causes remaining draggables to change position

Reported by: ahildoer Owned by:
Priority: minor Milestone:
Component: ui.draggable Version: 1.8.5
Keywords: draggable delete position relative Cc:
Blocked by: Blocking:


When deleting a draggable div that has draggable siblings below it in the DOM, the below siblings move after the deletion. This is because the draggable divs are position: relative. By hacking the source code I was able to remove the bug in my application by changing:

this.element[0].style.position="relative"; to this.element[0].style.position="absolute";

Although the fix is simple, I would rather a better solution to the problem be introduced, such has a position argument for the draggable behavior. I also like running stock 3rd party libs so having solution in the trunk is better than me modifying every copy. Note, although resizable is similar to draggable in that it can adjust the position of the top left corner of a div, resizable does not suffer from this problem.

Change History (3)

comment:1 Changed 12 years ago by Scott González

Resolution: worksforme
Status: newclosed

Just make your elements absolutely positioned before making it draggable.

comment:2 Changed 12 years ago by ahildoer

Here is more information on the behavior. And maybe this ticket should be a feature request instead of a bug in light of the following information.

draggable only checks to see if the element is positioned absolute when draggable is first applied. If position absolute, for example, is later applied via css, say when the element is attached to a new location in the DOM, the element remains position relative.

comment:3 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.