JS Floating clientx,pagex,offsetx,x

Source: Internet
Author: User

ScreenX: The coordinates of the mouse on the display screen.
ClientX: The coordinates of the mouse display area on the page.
Note: All the above two are common to all browsers.
Pagex:ff unique, the mouse position on the page, starting from the top left corner of the page positioning, this can be very convenient in the entire page positioning, ie no direct replacement attributes.
Layerx:ff unique, the mouse is positioned relative to the boundary of the position's parent element closest to the level of the element that triggers the event, starting from the upper-left corner of the border, that is, if the parent element exists border, The coordinate origin is in the upper-left corner of the border, not the upper-left corner of the content area.
Offsetx:ie unique, the mouse relative to the "trigger event element" position, starting from the top left corner of the content area, not from the top left corner of border! This property is useful to determine where the mouse point in an element is convenient, FF does not have a direct replacement attribute.
X:ie unique, with Layerx an effect, can be used as a direct replacement of Layerx properties.
Note: IE and FF positioning has a 1px difference, in fact, ie positioning from 0 onwards, FF positioning from 1, FF will always be larger than IE 1px, need to deal with the actual situation.
Offsetleft: This property is not the property of the event object, but of the DOM object, which represents the position of the DOM object in the "nearest to the object in the hierarchy of the DOM object, setting the Position parent object", though that is However, different browser effects are not the same, FF strictly follow the instructions above, but in Ie6/7, this property returns the DOM object in its immediate parent object, but IE8 corrected the problem, but IE8 has a new problem, Other browsers are from the parent object's content area of the upper-left corner of the location, IE8 really from the parent element of the upper-left corner of the border position, because the test environment for the IETester IE8, can not be excluded is the problem of IETester

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.