December 2013
Intermediate to advanced
384 pages
9h 54m
English
function myHandler(e){ $("#p1").html("From left side of screen: " + e.screenX); $("#p2").html("From right side of screen: " + e.screenX); $("#p3").html("From left side of browser: " + e.clientX); $("#p4").html("From right side of browser: " + e.clientY); }
For many graphical web apps, it is critical to not only know what target mouse events originated in, but the exact location on the screen or in the web browser display. The JavaScript mouse event object includes the event.screenX and event.screenY attributes that allow you to get the offset from the top and left of the screen in pixels.
Additionally, the JavaScript mouse event includes the event.clientY and event.clientY ...
Read now
Unlock full access