]> source.dussan.org Git - jquery-ui.git/commitdiff
Simulate: account for document scroll in findCenter function. Fixes #6859 - Jquery...
authorRichard D. Worth <rdworth@gmail.com>
Thu, 26 May 2011 08:58:15 +0000 (04:58 -0400)
committerRichard D. Worth <rdworth@gmail.com>
Thu, 26 May 2011 09:09:03 +0000 (05:09 -0400)
(cherry picked from commit de3fc0050ee672ce155f0dd65ee9ecdfd818c063)

tests/jquery.simulate.js

index a88b6cbe4ea6478bd9bd5411058160ba55b3ca8c..bb82624d3127e5a958d3c77f7a77588bcdfee2fc 100644 (file)
@@ -123,10 +123,10 @@ $.extend($.simulate.prototype, {
                this.simulateEvent(target, "click", coord);
        },
        findCenter: function(el) {
-               var el = $(this.target), o = el.offset();
+               var el = $(this.target), o = el.offset(), d = $(document);
                return {
-                       x: o.left + el.outerWidth() / 2,
-                       y: o.top + el.outerHeight() / 2
+                       x: o.left + el.outerWidth() / 2 - d.scrollLeft(),
+                       y: o.top + el.outerHeight() / 2 - d.scrollTop()
                };
        }
 });