Return the x and y coordinates of the window:
let x = window.screenLeft;
let y = window.screenTop;
Try it Yourself »
The screenLeft
property returns the x (horizontal) position of a window, relative to the screen.
window.screenLeft
Type | Description |
A number | The x (horizontal) position of the window relative to the screen, in pixels. |
window.screenLeft
is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
window.screenLeft
was not supported in Firefox before version 64 (Nov 2018).
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!