Name

offsetX, offsetY — NN n/a IE 4 DOM n/a

Synopsis

Read-only

The left and top coordinates of the mouse pointer relative to the containing element (exclusive of padding, borders, or margins) when the event fired. You can determine the containing element via the offsetParent property. See Section 9.2 at the beginning of this chapter about offset measurement anomalies in Internet Explorer 4.

Example

if (event.offsetX <= 20 && event.offsetY <=40) {
    ...
}

Value

Integer pixel count.

Default

None.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.