MouseEvent: screenY property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
ThescreenY read-only property of theMouseEvent interface provides the vertical coordinate (offset) of the mouse pointer inscreen coordinates.
In this article
Value
Adouble floating point value in pixels.
Early versions of the spec defined this as an integer referring to the number of pixels.
Examples
This example displays your mouse's coordinates whenever you trigger themousemove event.
HTML
html
<p>Move your mouse to see its position.</p><p></p>JavaScript
js
let screenLog = document.querySelector("#screen-log");document.addEventListener("mousemove", logKey);function logKey(e) { screenLog.innerText = ` Screen X/Y: ${e.screenX}, ${e.screenY} Client X/Y: ${e.clientX}, ${e.clientY}`;}Result
Specifications
| Specification |
|---|
| UI Events> # dom-mouseevent-screeny> |