aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.draggable.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-12-30 10:05:51 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-12-30 10:05:51 +0000
commitc4b7f1f9f062c64ce65970ae1c6edea4ec592a35 (patch)
tree825a2feb30e405c410401feed675abc4e879c96e /ui/ui.draggable.js
parente9bb4f54810e1cf09a96bce67b156bec793f6ec6 (diff)
downloadjquery-ui-c4b7f1f9f062c64ce65970ae1c6edea4ec592a35.tar.gz
jquery-ui-c4b7f1f9f062c64ce65970ae1c6edea4ec592a35.zip
demos: added opacity, revert and scroll demos
draggable: fixed positioning issue with relative positioned elements relative to the body during scroll
Diffstat (limited to 'ui/ui.draggable.js')
-rw-r--r--ui/ui.draggable.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index f667c3b36..e6ccc2280 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -588,13 +588,23 @@ $.ui.plugin.add("draggable", "scroll", {
- //This is a special case where we need to modify a offset calculated on start, since the following happened:
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
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();
+ }
+
}
});