aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.draggable.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-12-11 13:39:15 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-12-11 13:39:15 +0000
commit68e700b30b1ec65d990092bc81d6be01525a64be (patch)
tree97c79107beb16a067d7281921a79829e6f34a828 /ui/ui.draggable.js
parent315017ade983331b1756e55459a9a9939d62e42a (diff)
downloadjquery-ui-68e700b30b1ec65d990092bc81d6be01525a64be.tar.gz
jquery-ui-68e700b30b1ec65d990092bc81d6be01525a64be.zip
sortable,draggable: fixed issues with _convertPositionTo, missed from latest re-factor, miscalculated the absolute position including scroll
Diffstat (limited to 'ui/ui.draggable.js')
-rw-r--r--ui/ui.draggable.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index b9c622f0d..d1eeef659 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -262,20 +262,21 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
if(!pos) pos = this.position;
var mod = d == "absolute" ? 1 : -1;
+ var scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return {
top: (
pos.top // the calculated relative position
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
- + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'].scrollTop() ) * mod
+ + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod
+ this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)
),
left: (
pos.left // the calculated relative position
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
- + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'].scrollLeft() ) * mod
+ + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) * mod
+ this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)
)
};