Fix normalization of pageX and pageY event properties in IE (#1571). Thanks wizzud.
This commit is contained in:
parent
92aac3abd6
commit
a5f95c88c1
|
@ -267,8 +267,8 @@ jQuery.event = {
|
||||||
// Calculate pageX/Y if missing and clientX/Y available
|
// Calculate pageX/Y if missing and clientX/Y available
|
||||||
if ( event.pageX == null && event.clientX != null ) {
|
if ( event.pageX == null && event.clientX != null ) {
|
||||||
var doc = document.documentElement, body = document.body;
|
var doc = document.documentElement, body = document.body;
|
||||||
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0);
|
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
|
||||||
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0);
|
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientLeft || 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add which for key events
|
// Add which for key events
|
||||||
|
|
Loading…
Reference in a new issue