From: Richard D. Worth Date: Thu, 26 May 2011 08:58:15 +0000 (-0400) Subject: Simulate: account for document scroll in findCenter function. Fixes #6859 - Jquery... X-Git-Tag: 1.9m6~111^2~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=de3fc0050ee672ce155f0dd65ee9ecdfd818c063;p=jquery-ui.git Simulate: account for document scroll in findCenter function. Fixes #6859 - Jquery.Simulate drag behaves incorrect when container scrolled --- diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index a88b6cbe4..bb82624d3 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -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() }; } });