diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-12-30 15:05:09 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-12-30 15:05:09 +0000 |
commit | 76cea24b766b2d36c25137b3f456741996256da0 (patch) | |
tree | e90c8719348188b91572fef6e70f7296af647d35 /ui | |
parent | 8bd784a6f3b483b96ad7f536b4872e8ab94c7afe (diff) | |
download | jquery-ui-76cea24b766b2d36c25137b3f456741996256da0.tar.gz jquery-ui-76cea24b766b2d36c25137b3f456741996256da0.zip |
sortable: merged draggable fixes into sortables (r1325,1313)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.sortable.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index b15d13ebe..0502717e3 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -715,10 +715,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { var over = ($(ce).css("overflow") != 'hidden'); this.containment = [ - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left, - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top, - co.left + (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.margins.left - (parseInt(this.currentItem.css("marginRight"),10) || 0), - co.top + (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.margins.top - (parseInt(this.currentItem.css("marginBottom"),10) || 0) + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.margins.top, + co.left + (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.margins.left, + co.top + (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.margins.top ]; } @@ -988,6 +988,14 @@ $.ui.plugin.add("sortable", "scroll", { if(scrolled !== false && i.cssPosition == 'absolute' && i.scrollParent[0] != document && $.ui.contains(i.scrollParent[0], i.offsetParent[0])) { i.offset.parent = i._getParentOffset(); } + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(scrolled !== false && i.cssPosition == 'relative' && !(i.scrollParent[0] != document && i.scrollParent[0] != i.offsetParent[0])) { + i.offset.relative = i._getRelativeOffset(); + } } }); |