MouseEvent offsetY Property

Example

Get the y-coordinate of a click:

let y = event.offsetY;
Try it Yourself »

Description

The offsetY property returns the relative vertical coordinate of the mouse pointer when a mouse event occurs.

The offsetY property is read-only.


Coordinate Properties

PropertyRelative to
The screenX PropertyThe Screen area
The screenY PropertyThe Screen area
The clientX PropertyThe Window area
The clientY PropertyThe Window area
The pageX PropertyThe Page (Document)
The pageY PropertyThe Page (Document)
The offsetX PropertyThe target Element
The offsetY PropertyThe target Element

See Also:

The Mouse Event Object



Syntax

event.offsetY

Technical Details

Return Value: A Number
The vertical pixel coordinate of the mouse pointer
DOM Version: DOM Level 1 Mouse Events

Browser Support

event.offsetY is a DOM Level 1 (1998) feature.

It is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 9-11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.