--- title: WheelEvent.deltaX slug: Web/API/WheelEvent/deltaX translation_of: Web/API/WheelEvent/deltaX ---

{{APIRef("DOM Events")}}

WheelEvent.deltaX 只读属性是一个 double 类型值, 声明水平滚动量以{{domxref("WheelEvent.deltaMode")}} 为单位.

语法

var dX = event.deltaX;

例子

var syntheticEvent = new WheelEvent("syntheticWheel", {"deltaX": 4, "deltaMode": 0});

console.log(syntheticEvent.deltaX);

规范

Specification Status Comment
{{SpecName('DOM3 Events','#widl-WheelEvent-deltaX','WheelEvent.deltaX')}} {{Spec2('DOM3 Events')}} Initial definition.

浏览器兼容性

{{ CompatibilityTable() }}

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 31 {{CompatVersionUnknown}} {{ CompatGeckoDesktop("17.0") }} {{ CompatIE("9.0") }} [1] 18 {{ CompatNo() }}
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatVersionUnknown() }} {{CompatVersionUnknown}} {{ CompatGeckoMobile("17.0") }} {{ CompatUnknown() }} {{ CompatVersionUnknown() }} {{ CompatNo() }}

[1] IE9 支持一个规范的一个旧版本的草稿, 这里的值的类型是 long 而不是一个 double 类型的值.

另见