JavaScript Tips: How to Determine Browser Window Position
P粉218775965
P粉218775965 2023-08-22 15:53:05
0
2
592
<p>For various silly reasons, I want to be able to detect a rectangular area of ​​the browser window on the screen, including the title bar. </p> <p>Is this possible, or is JavaScript only limited to the viewport of its page? </p> <p><strong>Edit: </strong>I may not have expressed it clearly, but the viewport is the part of the page that is visible in the window. This may not be a commonly used term among browsers, but it's common in graphics. </p>
P粉218775965
P粉218775965

reply all(2)
P粉785957729

Please check the following properties:

(These properties do not give the size or position of the window, but they can be interpreted correctly when operating a system with multiple monitors)

P粉081360775

For standards-compliant browsers:

X - window.screenX
Y - window.screenY

For IE browser:

X - window.screenLeft
Y - window.screenTop

Please keep in mind that implementations may vary. Please note multi-monitor setup...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!