Get window locations across browsers

Source: Internet
Author: User

IE, Safari, Opera, and chrome all provide screenleft and screentop properties that indicate the position of the window relative to the left and top of the screen, respectively.

Firefox, Safari, and Chrome provide the same window information in ScreenX and ScreenY.

Opera supports ScreenX and ScreenY properties, but with Screenleft and screentop properties do not correspond, so do not use in opera ScreenX and ScreenY.

Use the following code to get the window position across browsers:

1 var leftpos = (typeof Window.screenleft = = "Number")?  2var topolpos = (typeof Window.screentop = = "Number")? Window.screentop: Window.screeny;

Get window locations across browsers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.