The MouseEvent.movementX
read-only property provides the shift in the X coordinate of the mouse pointer between that event and the previous mousemove
event. In other words, the value of that property is computed that way : currentEvent.movementX = currentEvent.screenX - previousEvent.screenX
.
var xShift = instanceOfMouseEvent.movementX
A number
Specification | Status | Comment |
---|---|---|
Pointer Lock The definition of 'MouseEvent.movementX' in that specification. | Candidate Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 37
|
Yes | 41
|
No | ? | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 37 | 37
|
Yes | 41
|
? | No | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX