2015.10.9JS (page coordinates)

Source: Internet
Author: User
About JS Mouse events Comprehensive browser can get the properties of the coordinates

1.page with the scrollbar change (Pagey will increase the distance of scroll bar scrolling), Compatibility: Except IE6/7/8 not supported, the rest of the browser support;

2.clientx/y gets the trigger point relative to the upper-left corner of the viewable area of the browser (does not change with the page scrolling, Clieny does not increase), compatibility: all browsers support;

3.screenx/y gets the distance that the trigger point is relative to the upper-left corner of the display screen and does not change with the page scrolling, compatibility: all browsers support

The code for compatible Pagex in jquery is as follows
if (Event.pagex = = NULL && EVENT.CLIENTX! = null) {
var doc = document.documentelement, BODY = document.body;
Event.pagex = Event.clientx + (Doc && Doc.scrollleft | | body && Body.scrollleft | | 0)-(Doc && do C.clientleft | | Body && Body.clientleft | | 0);
Event.pagey = Event.clienty + (Doc && Doc.scrolltop | | body && Body.scrolltop | | 0);
}

2015.10.9JS (page coordinates)

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.