Skip to content

Commit ee2c8c0

Browse files
committed
Draggable: Don't adjust offsets for fixed position elements in Safari 4.
Fixes #4631 - Draggable: Fixed positions include wrong scroll offset in Safari 4.
1 parent 7321aa0 commit ee2c8c0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ui/jquery.ui.draggable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ $.widget("ui.draggable", $.ui.mouse, {
366366
pos.top // The absolute mouse position
367367
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
368368
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
369-
- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
369+
- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
370370
),
371371
left: (
372372
pos.left // The absolute mouse position
373373
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
374374
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
375-
- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
375+
- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
376376
)
377377
};
378378

@@ -423,14 +423,14 @@ $.widget("ui.draggable", $.ui.mouse, {
423423
- this.offset.click.top // Click offset (relative to the element)
424424
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
425425
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
426-
+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
426+
+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
427427
),
428428
left: (
429429
pageX // The absolute mouse position
430430
- this.offset.click.left // Click offset (relative to the element)
431431
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
432432
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
433-
+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
433+
+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
434434
)
435435
};
436436

0 commit comments

Comments
 (0)