Skip to content

Commit

Permalink
Simulate: account for document scroll in findCenter function. Fixes #…
Browse files Browse the repository at this point in the history
…6859 - Jquery.Simulate drag behaves incorrect when container scrolled
  • Loading branch information
rdworth committed May 26, 2011
1 parent fe4ae30 commit de3fc00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/jquery.simulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
}
});
Expand Down

0 comments on commit de3fc00

Please sign in to comment.