draggable: fixed #2919

This commit is contained in:
Paul Bakaus 2008-05-25 15:39:24 +00:00
parent 620ed33295
commit 074bd8d1ab

View File

@ -20,13 +20,13 @@
//Initialize needed constants //Initialize needed constants
var o = this.options; var o = this.options;
this.mouseInit();
//Position the node //Position the node
if(o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position'))) if(o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position')))
this.element.css('position', 'relative'); this.element.css('position', 'relative');
this.mouseInit();
}, },
mouseStart: function(e) { mouseStart: function(e) {
var o = this.options; var o = this.options;
@ -128,14 +128,16 @@
pos.top // the calculated relative position 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.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.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) + this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)
), ),
left: ( left: (
pos.left // the calculated relative position 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.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.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) + 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.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.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.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: ( left: (
e.pageX // The absolute mouse position e.pageX // The absolute mouse position
- this.offset.click.left // Click offset (relative to the element) - 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.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.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)
) )
}; };