From 074bd8d1ab4063351bb6d51be4318a486b04cf5c Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Sun, 25 May 2008 15:39:24 +0000 Subject: [PATCH] draggable: fixed #2919 --- ui/source/ui.draggable.js | 18 +++++++++++------- 1 file 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) ) }; -- 2.39.5