Window: screenX 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.
* Some parts of this feature may have varying levels of support.
The screenX read-only property of the Window interface returns the horizontal distance, in CSS pixels, from the left border of the user's browser window to the left side of the screen.
Note:
Window.screenLeft is an alias of the older screenX property. screenLeft was originally supported only in IE but was introduced everywhere due to popularity.
Value
A number equal to the number of CSS pixels from the left edge of the browser window to the left edge of the screen.
Examples
In our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. In this example we are using Window.screenLeft/Window.screenTop plus Window.requestAnimationFrame() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved.
See Window.screenLeft for more information.
Specifications
| Specification |
|---|
| CSSOM View Module> # dom-window-screenx> |