MouseEvent.movementX
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
MouseEvent.movementX
是只读属性,它提供了当前事件和上一个mousemove
事件之间鼠标在水平方向上的移动值。换句话说,这个值是这样计算的 : currentEvent.movementX = currentEvent.screenX - previousEvent.screenX
.
语法
var xShift = instanceOfMouseEvent.movementX
返回值
一个数字
规范
Specification |
---|
Pointer Lock 2.0 # dom-mouseevent-movementx |
浏览器兼容性
BCD tables only load in the browser