MouseEvent.pageY

pageY是一个只读属性,它返回触发事件的位置相对于整个 document 的 Y 坐标值。由于其参考物是整个 dom,所以这个值受页面垂直方向的滚动影响。例如:当你垂直方向向下滚动了 50 pixel,那么你在顶端进行点击的时候,获取的pageY为 50pixed 而不是 0。最初这个属性被定义为长整型(long integer),如今 CSSOM 视图模块将其重新定义为双精度浮点数(double float)。你可以查阅浏览器兼容性部分的文档来进一步了解有关信息。

语法

var pos = event.pageY

示例

var pageY = event.pageY;

规范

Specification Status Comment
CSS Object Model (CSSOM) View Module
pageY
Working Draft Redefined from long to double.
Touch Events
pageY
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! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 45 (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. 45 (Yes) ? ? ? ? ?
Redefined from long to double 56 56 ? ? ? ? ? ?

更多请见