getMousePosition


 / Published in: JavaScript
 

  1. function getMouseX( e ) {
  2. return e.pageX
  3. || ( e.clientX + ( document.documentElement.scrollLeft
  4. || document.body.scrollLeft ) );
  5. }
  6. function getMouseY( e ) {
  7. return e.pageY
  8. || ( e.clientY + ( document.documentElement.scrollTop
  9. || document.body.scrollTop ) );
  10. }

Report this snippet  

You need to login to post a comment.