MouseEvent.pageX

The MouseEvent.pageX read-only property returns the horizontal coordinate of the event relative to the whole document.

Syntax

JavaScript
var pos = event.pageX

Examples

JavaScript
var pageX = event.pageX;

pageX is an integer value in pixels for the X coordinate of the mouse pointer, relative to the whole document, when the mouse event fired. This property takes into account any horizontal scrolling of the page.

Specifications

Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'pageX' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 45.0 (Yes) 9 (Yes) (Yes)
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? 45.0 ? ? ? ? ? 45.0

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/mouseevent/pagex

API DOM Property Read-only Reference