MouseEvent.movementX

 MouseEvent.movementX 是只读属性,它提供了当前事件和上一个mousemove (en-US)事件之间鼠标在水平方向上的移动值。换句话说,这个值是这样计算的 : currentEvent.movementX = currentEvent.screenX - previousEvent.screenX.

语法

var xShift = instanceOfMouseEvent.movementX

返回值

一个数字

规范

Specification Status Comment
Pointer Lock
MouseEvent.movementX
Candidate Recommendation 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
Basic support 22.0 webkit (en-US)
37.0 unprefixed
(Yes)

1.0 (1.7 or earlier) moz (en-US)
41 (41)

未实现 ? 未实现
Feature Android Webview Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 37 (Yes) 1.0 (1.0) moz (en-US)
41.0 (41)
未实现 ? 未实现 (Yes) webkit (en-US)
37.0 unprefixed

相关