|
|
@ -431,58 +431,6 @@ exports.getAbsoluteTop = function(elem) { |
|
|
|
return elem.getBoundingClientRect().top + window.pageYOffset; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the absolute, vertical mouse position from an event. |
|
|
|
* @param {Event} event |
|
|
|
* @return {Number} pageY |
|
|
|
*/ |
|
|
|
exports.getPageY = function(event) { |
|
|
|
if ('pageY' in event) { |
|
|
|
return event.pageY; |
|
|
|
} |
|
|
|
else { |
|
|
|
var clientY; |
|
|
|
if (('targetTouches' in event) && event.targetTouches.length) { |
|
|
|
clientY = event.targetTouches[0].clientY; |
|
|
|
} |
|
|
|
else { |
|
|
|
clientY = event.clientY; |
|
|
|
} |
|
|
|
|
|
|
|
var doc = document.documentElement; |
|
|
|
var body = document.body; |
|
|
|
return clientY + |
|
|
|
( doc && doc.scrollTop || body && body.scrollTop || 0 ) - |
|
|
|
( doc && doc.clientTop || body && body.clientTop || 0 ); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the absolute, horizontal mouse position from an event. |
|
|
|
* @param {Event} event |
|
|
|
* @return {Number} pageX |
|
|
|
*/ |
|
|
|
exports.getPageX = function(event) { |
|
|
|
if ('pageY' in event) { |
|
|
|
return event.pageX; |
|
|
|
} |
|
|
|
else { |
|
|
|
var clientX; |
|
|
|
if (('targetTouches' in event) && event.targetTouches.length) { |
|
|
|
clientX = event.targetTouches[0].clientX; |
|
|
|
} |
|
|
|
else { |
|
|
|
clientX = event.clientX; |
|
|
|
} |
|
|
|
|
|
|
|
var doc = document.documentElement; |
|
|
|
var body = document.body; |
|
|
|
return clientX + |
|
|
|
( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - |
|
|
|
( doc && doc.clientLeft || body && body.clientLeft || 0 ); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* add a className to the given elements style |
|
|
|
* @param {Element} elem |
|
|
|