onmousewheel
mousewheel
event triggers asynchronously on an element when a mouse wheel or similar input device is used. This event was never included in any official web standard. Although some browsers implemented it, Firefox never supported it.onmousewheel event
The onmousewheel
event activates a <script>
when the mouse wheel is scrolled over an element. It is commonly used to create custom scrolling effects or zoom functionality in web applications.
Syntax
You can use the event name with methods like addEventListener()
or by assigning it to an event handler property.
addEventListener("mousewheel", (event) => {});
onmousewheel = (event) => {};
Conclusion
The onmousewheel
event is used to trigger actions when the mouse wheel is scrolled over an element. While it is commonly used for custom scrolling and zoom effects, it is now deprecated. Developers are encouraged to use alternative methods like wheel
for better compatibility and support.
onmouseup
The onmouseup event is triggered when a mouse button is released over an element. It follows a specific order of events for the left and middle mouse buttons.
onwheel
The onwheel event is triggered when the mouse wheel is scrolled over an element. It also activates when the user scrolls using a touchpad.