Home > Web Front-end > JS Tutorial > The position of mouse event in JavaScript (clientX, layerX, x, offsetX, etc.)

The position of mouse event in JavaScript (clientX, layerX, x, offsetX, etc.)

高洛峰
Release: 2016-11-28 09:39:34
Original
1221 people have browsed it

The event object in JavaScript has a total of six pairs of mouse position attributes. They are as follows:

Attributes to reference points Browser compatibility

clientX, clientY Browser window all

layerX, layerY

The nearest absolutely positioned parent node, if not, the document Firefox, Chrome, Safari

offsetX, offsetY All event target objects, except Firefox

pageX, pageY document objects, except IE

ScreenX, ScreenY All computer screens

x,y Try not to use it, the compatibility is poor with IE9 and below


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template