Skip to content
Permalink
Browse files
Simulate: account for document scroll in findCenter function. Fixes #…
…6859 - Jquery.Simulate drag behaves incorrect when container scrolled

(cherry picked from commit de3fc00)
  • Loading branch information
rdworth committed May 26, 2011
1 parent ed65ce7 commit bb076e3
Showing 1 changed file with 3 additions and 3 deletions.
@@ -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()
};
}
});

0 comments on commit bb076e3

Please sign in to comment.