I have a jQueryUI drag and drop object and a sortable object on the page.
Dragging and dropping an element from a dragged object to a sortable one causes the element to be dragged up in the upper left corner of the page .
Here's a demo: http://jsfiddle.net/travisrussi/aBhDu/1/
Playback:
- Drag the "5" element from the draggable div (upper drawer) to the sortable div (lower drawer)
Actual result:
It seems that the draggable items are switched relative to absolute positioning . The draggable "li" switches from:
<li class="ui-state-default ui-draggable" style="position: relative; left: 52px; top: 9px;">Item 3</li>
:
<li class="ui-state-default ui-draggable ui-sortable-helper" style="position: absolute; left: 67px; top: 91px; width: 80px; height: 20px;">Item 3</li>
when a dragged item is dragged into a sortable object.
This is the corresponding snippet from jQueryUI 1.8.12 (starts at line 3041):
//The element absolute position on the page minus margins this.offset = this.currentItem.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; // Only after we got the offset, we can change the helper position to absolute // TODO: Still need to figure out a way to make relative sorting possible this.helper.css("position", "absolute"); this.cssPosition = this.helper.css("position"); $.extend(this.offset, { click: { //Where the click happened, relative to the element left: event.pageX - this.offset.left, top: event.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper }); //Generate the original position this.originalPosition = this._generatePosition(event); this.originalPageX = event.pageX; this.originalPageY = event.pageY;
Is there some kind of configuration parameter that I am not using?
Is there a problem with CSS?
Or is this a bug in jqueryUI?
source share