--- title: MouseEvent.movementY slug: Web/API/MouseEvent/movementY translation_of: Web/API/MouseEvent/movementY ---
{{APIRef("DOM Events")}}
MouseEvent.movementY
是只读属性,它提供了当前事件和上一个 {{event("mousemove")}} 事件之间鼠标在水平方向上的移动值。换句话说,这个值是这样计算的 :currentEvent.movementY = currentEvent.screenY - previousEvent.screenY
.
var yShift = instanceOfMouseEvent.movementY
A number
Specification | Status | Comment |
---|---|---|
{{SpecName('Pointer Lock','#widl-MouseEvent-movementY','MouseEvent.movementY')}} | {{Spec2('Pointer Lock')}} | Initial definition. |
{{ CompatibilityTable() }}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | {{CompatChrome(22.0)}} {{property_prefix("webkit")}} {{CompatChrome(37.0)}} unprefixed |
{{CompatVersionUnknown}} | {{CompatGeckoDesktop(1.0)}} {{property_prefix("moz")}} {{CompatGeckoDesktop(41)}} |
{{ CompatNo() }} | {{ CompatUnknown() }} | {{ CompatNo() }} |
Feature | Android Webview | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | {{CompatChrome(37.0)}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile(1.0)}} {{property_prefix("moz")}} {{CompatGeckoMobile(41)}} |
{{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{CompatVersionUnknown}} {{property_prefix("webkit")}} {{CompatChrome(37.0)}} unprefixed |