WheelEvent: WheelEvent() constructor
The WheelEvent()
constructor returns a new WheelEvent
object.
Note: If you construct a synthetic event using this constructor, that event will not be trusted , for security reasons. Only browser-generated WheelEvent
objects are trusted and only trusted events trigger default actions.
Syntax
new WheelEvent ( type)
new WheelEvent ( type, options)
Parameters
type
A string with the name of the event. It is case-sensitive and browsers always set it to wheel
.
options
Optional
An object that, in addition of the properties defined in MouseEvent()
, can have the following properties:
deltaX
Optional
A floating number representing the horizontal scroll amount in the deltaMode
unit. It defaults to 0.0
.
deltaY
Optional
A floating number representing the vertical scroll amount in the deltaMode
unit. It defaults to 0.0
.
deltaZ
Optional
A floating number representing the scroll amount for the z-axis scroll amount in the deltaMode
unit. It defaults to 0.0
.
deltaMode
Optional
An integer representing the unit of the delta values scroll amount. It defaults to 0x00
. Permitted values are:
Constant
Value
Description
DOM_DELTA_PIXEL
0x00
The delta values are specified in pixels.
DOM_DELTA_LINE
0x01
The delta values are specified in lines.
DOM_DELTA_PAGE
0x02
The delta values are specified in pages.
Return value
Specifications
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
4.4
26
17
14
7
1.0
See also