mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Simulate: account for document scroll in findCenter function. Fixes #6859 - Jquery.Simulate drag behaves incorrect when container scrolled
(cherry picked from commit de3fc0050e
)
This commit is contained in:
parent
ed65ce7a14
commit
bb076e313f
@ -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()
|
||||
};
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user