screenX(Y),clientX(Y)和pageX(Y),offsetX(Y)和layerX(Y)

http://blog.csdn.net/lzding/article/details/45437707

  • event.screenX(Y) is the x, y coordinates of the mouse relative to the upper left corner of the display screen. Standard event properties, supported by all browsers
  • event.clientX(Y) is the X and Y coordinates of the mouse relative to the visible area (window) of the browser window. The visible area does not include toolbars and scroll bars. Standard event properties, supported by all browsers
  • event.pageX(Y) is the coordinates of the mouse relative to the document . In the case of no scroll bar, the width and height are generally equal to clientX (Y). When there is a scroll bar, pageX(Y)=clientX(Y)+horizontal (vertical) scrolling distance. It is not a standard attribute, but it is widely supported, only the previous version of ie9 does not support it
  • offsetX(Y) The distance between the trigger point and the upper left corner of the triggered dom. IE event attribute, not supported by Firefox
  • layerX(Y) The distance between the trigger point and the upper left corner of the triggered dom. The value is the same as offsetX/Y. This variable is used by firefox to replace offsetX/Y. The reference point is the upper left corner of the border, but there is a condition that the triggered dom needs to be set to position:relative or position:absolute, otherwise it will return the distance relative to the upper left corner of the html document area. Oupeng browser and IE9 were not supported before.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324437935&siteId=291194637