Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simulate: account for document scroll in findCenter function. Fixes #…

…6859 - Jquery.Simulate drag behaves incorrect when container scrolled
  • Loading branch information...
commit de3fc0050ee672ce155f0dd65ee9ecdfd818c063 1 parent fe4ae30
@rdworth rdworth authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 tests/jquery.simulate.js
View
6 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()
};
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.