MouseEvent offsetY property

definition and usage

The offsetY property returns the y coordinate of the mouse pointer relative to the target element.

hint:To get the x coordinate, use the offsetX property.

note:This property is read-only.

example

Click inside the DIV and output the y coordinate of this click relative to the DIV element:

var x = event.offsetY;

try it yourself

You can find more TIY examples below the page.

syntax

event.offsetY

technical details

return value: number, indicating the vertical coordinate of the mouse pointer in pixels.

browser support

property Chrome IE Firefox Safari Opera
offsetY support 6 39 support support

page related

MouseEvent: property offsetX

MouseEvent: property clientX

MouseEvent: ویژگی clientY

MouseEvent: ویژگی screenX

MouseEvent: ویژگی screenY