WheelEvent()
The WheelEvent() constructor returns a newly created WheelEvent object.
Syntax
var wheelEvent = new WheelEvent(typeArg, wheelEventInit);
Properties
typeArg-
Is a
DOMStringrepresenting the name of the event. -
wheelEventInitOptional -
Is a
WheelEventInitdictionary, having the following fields:-
"deltaX", optional and defaulting to0.0, is adoublerepresenting the horizontal scroll amount in thedeltaModeunit. -
"deltaY", optional and defaulting to0.0, is adoublerepresenting the vertical scroll amount in thedeltaModeunit. -
"deltaZ", optional and defaulting to0.0, is adoublerepresenting the scroll amount for the z-axis in thedeltaModeunit. -
"deltaMode", optional and defaulting to0, is aunsigned longrepresenting the unit of the delta values scroll amount. Permitted values are:Constant Value Description DOM_DELTA_PIXEL0x00The delta values are specified in pixels. DOM_DELTA_LINE0x01The delta values are specified in lines. DOM_DELTA_PAGE0x02The delta values are specified in pages.
Note: The
WheelEventInitdictionary also accepts fields from theMouseEventInit,UIEventInitandEventInitdictionaries. -
Specifications
| Specification |
|---|
| UI Events # dom-wheelevent-wheelevent |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
WheelEvent |
26 |
12 |
17 |
No |
15 |
7 |
≤37 |
26 |
17 |
14 |
7 |
1.0 |
See also
- The
WheelEventinterface it belongs to.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/WheelEvent