MouseEvent.pageX
pageX
是一个由MouseEvent
接口返回的相对于整个文档的x(水平)坐标以像素为单位的只读属性。
这个属性将基于文档的边缘,考虑任何页面的水平方向上的滚动。举个例子,如果页面向右滚动 200px 并出现了滚动条,这部分在窗口之外,然后鼠标点击距离窗口左边 100px 的位置,pageX 所返回的值将是 300。
起初这个属性被定义为长整型。 CSSOM 视图模块将它重新定位为双浮点数类型。请参阅浏览器兼容性部分了解详情。
语法
var pos = event.pageX
例子
var pageX = event.pageX;
规范
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module pageX |
Working Draft | Redefined from long to double . |
Touch Events pageX |
Unknown | Initial definition. |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 45.0 | (Yes) | (Yes) | 9 | (Yes) | (Yes) |
Redefined from long to double |
56 | ? | ? | ? | ? | ? |
Feature | Android Webview | Chrome for Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | 45.0 | 45.0 | (Yes) | ? | ? | ? | ? | ? |
Redefined from long to double |
56 | 56 | ? | ? | ? | ? | ? | ? |