1(function() {
2 document.onmousemove = handleMouseMove;
3 function handleMouseMove(event) {
4 var eventDoc, doc, body;
5
6 event = event || window.event; // IE-ism
7
8 // If pageX/Y aren't available and clientX/Y are,
9 // calculate pageX/Y - logic taken from jQuery.
10 // (This is to support old IE)
11 if (event.pageX == null && event.clientX != null) {
12 eventDoc = (event.target && event.target.ownerDocument) || document;
13 doc = eventDoc.documentElement;
14 body = eventDoc.body;
15
16 event.pageX = event.clientX +
17 (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
18 (doc && doc.clientLeft || body && body.clientLeft || 0);
19 event.pageY = event.clientY +
20 (doc && doc.scrollTop || body && body.scrollTop || 0) -
21 (doc && doc.clientTop || body && body.clientTop || 0 );
22 }
23
24 // Use event.pageX / event.pageY here
25 }
26})();