aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-05-25 16:06:24 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-05-25 16:06:24 +0000
commit70702aee59f49382cb660d59df7a814c099a6b11 (patch)
tree64744fa44b517bacd81e22e4b7a81b2a2d3fd86d /ui
parentb39129084414aa2caa688ad9d01465d6287f93dd (diff)
downloadjquery-ui-70702aee59f49382cb660d59df7a814c099a6b11.tar.gz
jquery-ui-70702aee59f49382cb660d59df7a814c099a6b11.zip
draggable: fixed absolute positioned element's scroll positions
Diffstat (limited to 'ui')
-rw-r--r--ui/source/ui.draggable.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui/source/ui.draggable.js b/ui/source/ui.draggable.js
index 13d60f736..f012e6f53 100644
--- a/ui/source/ui.draggable.js
+++ b/ui/source/ui.draggable.js
@@ -118,6 +118,7 @@
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
+ this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
return true;
},
convertPositionTo: function(d, pos) {
@@ -128,7 +129,7 @@
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.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.cssPosition == "absolute" && 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)
),
@@ -136,7 +137,7 @@
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.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.cssPosition == "absolute" && 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)
)
@@ -151,7 +152,7 @@
- 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" || 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.cssPosition == "absolute" && 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: (
@@ -159,7 +160,7 @@
- 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" || 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.cssPosition == "absolute" && 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)
)
};