jsBin DEMO
CLIENT → The Browser window
clientX
clientY
= values (px
) of the mouse position relative to the Browser's viewport boundaries.
Tip:
Even if you scroll the Document, the values are always the same
PAGE → The Whole Document
pageX
pageY
= values (px
) of the mouse position relative to the Document most-top/left "sides".
Tip:
If you scroll the Document (i.e) vertically, pageY
value changes cause it's the new mouse Top Position inside your Document.
Also it's worth noting that:
event.pageY - event.clientY === document.documentElement.scrollTop
( or jQuery's $("html, body").scrollTop()
)
SCREEN → Your Screen
screenX
and screenY
are the values (px
) of the current mouse position relative to the physical screen.
(No tip for this one ;))