MouseEvent offsetY attribute
Definition and usage
The offsetY attribute returns the y coordinate of the mouse pointer relative to the target element.
Tip:To get the x coordinate, please use the offsetX attribute.
Note:This attribute is read-only.
Example
Click inside the DIV and output the y coordinate of the click relative to the DIV element:
var x = event.offsetY;
You can find more TIY examples below the page.
Syntax
event.offsetY
Technical details
Return value: | A numerical value representing the vertical coordinate of the mouse pointer, in pixels. |
---|
browser support
attribute | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
offsetY | supported | 6 | 39 | supported | supported |
related pages
MouseEvent: offsetX attribute
MouseEvent: clientX attribute
MouseEvent: clientY Property
MouseEvent: screenX Property
MouseEvent: screenY Property