aboutsummaryrefslogtreecommitdiffstats
path: root/ui/source/ui.draggable.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-05-25 15:39:24 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-05-25 15:39:24 +0000
commit074bd8d1ab4063351bb6d51be4318a486b04cf5c (patch)
tree68fb6c086341ffe45eaa14abbece4dbe0eb2d3f6 /ui/source/ui.draggable.js
parent620ed3329559fd3641ef27c15b0c03632ca34ca0 (diff)
downloadjquery-ui-074bd8d1ab4063351bb6d51be4318a486b04cf5c.tar.gz
jquery-ui-074bd8d1ab4063351bb6d51be4318a486b04cf5c.zip
draggable: fixed #2919
Diffstat (limited to 'ui/source/ui.draggable.js')
-rw-r--r--ui/source/ui.draggable.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/source/ui.draggable.js b/ui/source/ui.draggable.js
index 73e91a238..13d60f736 100644
--- a/ui/source/ui.draggable.js
+++ b/ui/source/ui.draggable.js
@@ -20,13 +20,13 @@
//Initialize needed constants
var o = this.options;
-
- this.mouseInit();
-
+
//Position the node
if(o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))
this.element.css('position', 'relative');
+ this.mouseInit();
+
},
mouseStart: function(e) {
var o = this.options;
@@ -128,14 +128,16 @@
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" ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position, not if the element is fixed
+ - (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position, not if the element is fixed
+ + (this.cssPosition == "fixed" ? this.offsetParent[0].scrollTop : 0) * 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" ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position, not if the element is fixed
+ - (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position, not if the element is fixed
+ + (this.cssPosition == "fixed" ? this.offsetParent[0].scrollLeft : 0) * mod
+ this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)
)
};
@@ -149,14 +151,16 @@
- this.offset.click.top // Click offset (relative to the element)
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
- + (this.cssPosition == "fixed" ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed
+ + (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed
+ - (this.cssPosition == "fixed" ? this.offsetParent[0].scrollTop : 0)
),
left: (
e.pageX // The absolute mouse position
- this.offset.click.left // Click offset (relative to the element)
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
- + (this.cssPosition == "fixed" ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed
+ + (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed
+ - (this.cssPosition == "fixed" ? this.offsetParent[0].scrollLeft : 0)
)
};