]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Don't adjust offsets for fixed position elements in Safari 4.
authorScott González <scott.gonzalez@gmail.com>
Thu, 4 Feb 2010 21:52:20 +0000 (21:52 +0000)
committerScott González <scott.gonzalez@gmail.com>
Thu, 4 Feb 2010 21:52:20 +0000 (21:52 +0000)
Fixes #4631 - Draggable: Fixed positions include wrong scroll offset in Safari 4.

ui/jquery.ui.draggable.js

index 1753aa02b2d981ab80ec6b0375ff1e04d3260dc7..1f921a910c69134af405e731326ce095988c18cb 100644 (file)
@@ -366,13 +366,13 @@ $.widget("ui.draggable", $.ui.mouse, {
                                pos.top                                                                                                                                 // The absolute mouse 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)
-                               - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+                               - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
                        ),
                        left: (
                                pos.left                                                                                                                                // The absolute mouse 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)
-                               - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+                               - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
                        )
                };
 
@@ -423,14 +423,14 @@ $.widget("ui.draggable", $.ui.mouse, {
                                - 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)
-                               + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+                               + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
                        ),
                        left: (
                                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)
-                               + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+                               + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
                        )
                };