JavaScript Element mousewheel Event

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Deprecated
Non-standard
Instance event

What You’ll Learn

The mousewheel event once reported mouse-wheel movement in some browsers. Learn why it is deprecated and non-standard, how onmousewheel / wheelDelta worked, why Firefox never shipped it, and how to migrate to the standard wheel event—with five examples and try-it labs.

01

Kind

Instance event

02

Type

WheelEvent

03

When

Wheel operated

04

Handler

onmousewheel

05

Status

Deprecated · Non-standard

06

Modern path

wheel event

Introduction

mousewheel answered: “Is the user turning a mouse wheel (or similar device) over this element?” It fired asynchronously while the wheel was operated.

Today that job belongs to the standard wheel event. MDN’s guidance is clear: treat mousewheel as obsolete history—useful for reading old code, not for shipping new products.

💡
Beginner tip

If you see onmousewheel or addEventListener("mousewheel", …) in a codebase, plan a migration to wheel and prefer deltaY / deltaX over wheelDelta.

Understanding mousewheel

An instance event (legacy) that answered: “Did the wheel turn over this element?”

  • Fires while a mouse wheel or similar device is operated (in supporting engines).
  • WheelEvent — often inspected via legacy wheelDelta* fields.
  • Handleronmousewheel or addEventListener("mousewheel", ...).
  • Not in Firefox — MDN states Firefox never implemented mousewheel.
  • Deprecated & Non-standard on MDN; not part of any specification.

📝 Syntax

Legacy listeners used the event name with addEventListener, or the handler property:

JavaScript
addEventListener("mousewheel", (event) => { });

onmousewheel = (event) => { };

Prefer this instead

JavaScript
addEventListener("wheel", (event) => {
  // event.deltaY, event.deltaX, event.deltaMode
});

Event type

A WheelEvent (inherits from MouseEvent, UIEvent, and Event).

Handy properties (legacy focus)

PropertyMeaning
wheelDeltaLegacy abstract distance; sign/units vary by browser and OS
wheelDeltaX / wheelDeltaYLegacy horizontal / vertical components
deltaX / deltaY / deltaZStandard WheelEvent deltas (prefer these via wheel)
deltaModeUnit for standard deltas: pixel, line, or page

⚡ When mousewheel Fired

  • A mouse wheel or similar device was operated while the pointer was related to the element.
  • It could fire repeatedly during continuous scrolling (trackpads especially).
  • In Firefox it did not fire at all—another reason it failed as a cross-browser API.

⚖️ mousewheel vs wheel

Featuremousewheelwheel
Standard?No (non-standard)Yes
MDN statusDeprecatedRecommended
FirefoxNever implementedSupported
Primary deltaswheelDelta* (inconsistent)deltaX / deltaY
Use in new code?NoYes
💡
MDN guidance

Instead of this obsolete event, use the standard wheel event.

⚡ Quick Reference

GoalCode / note
Legacy listenel.addEventListener("mousewheel", fn) (avoid)
Legacy handlerel.onmousewheel = fn (avoid)
Modern listenel.addEventListener("wheel", fn)
Modern deltasevent.deltaY, event.deltaX, event.deltaMode
Firefoxmousewheel never existed—use wheel
MDN statusDeprecated · Non-standard

🔍 At a Glance

Four facts to remember about mousewheel.

Event type
WheelEvent

MouseEvent + more

Means
wheel moved

Legacy name

Status
deprecated

Non-standard

Replace with
wheel

Standard API

Examples Gallery

Examples follow MDN Element: mousewheel event for learning and migration. Prefer wheel in production. Scroll the stage with a mouse wheel or trackpad.

📚 Getting Started (Legacy)

How old code listened—study only; do not copy into new apps.

Example 1 — Legacy mousewheel Log

Log when the obsolete event fires (may do nothing in Firefox).

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");

stage.addEventListener("mousewheel", (event) => {
  out.textContent = "mousewheel fired (legacy)";
});
Try It Yourself

How It Works

In engines that still dispatch it, scrolling the stage triggers the listener. Firefox never did.

Example 2 — onmousewheel Property

The legacy handler property form (same status warnings apply).

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");

stage.onmousewheel = (event) => {
  out.textContent = "onmousewheel wheelDelta=" + event.wheelDelta;
};
Try It Yourself

How It Works

Prefer addEventListener("wheel", …) in modern code for multiple listeners and easy removal.

📈 Deltas, Standard wheel & Migration

See wheelDelta quirks, then switch to the standard wheel event.

Example 3 — Read Legacy wheelDelta

Show how inconsistent legacy deltas look during a scroll.

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");

stage.addEventListener("mousewheel", (event) => {
  out.textContent =
    "wheelDelta=" + event.wheelDelta +
    " X=" + event.wheelDeltaX +
    " Y=" + event.wheelDeltaY;
});
Try It Yourself

How It Works

MDN documents large browser/OS differences for these values—another reason to prefer deltaY on wheel.

Example 4 — Prefer Standard wheel

The replacement API you should use in new projects.

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");

stage.addEventListener("wheel", (event) => {
  out.textContent =
    "wheel deltaY=" + event.deltaY +
    " deltaX=" + event.deltaX +
    " mode=" + event.deltaMode;
});
Try It Yourself

How It Works

deltaMode tells you whether deltas are in pixels (0), lines (1), or pages (2).

Example 5 — Migration Helper (wheel first)

Listen for wheel; only fall back to mousewheel for ancient engines.

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");

function onScrollGesture(event, source) {
  const dy =
    source === "wheel"
      ? event.deltaY
      : -event.wheelDelta; // crude legacy map — prefer wheel
  out.textContent = source + " dy≈" + dy;
}

if ("onwheel" in window) {
  stage.addEventListener("wheel", (event) => onScrollGesture(event, "wheel"));
} else {
  stage.addEventListener("mousewheel", (event) =>
    onScrollGesture(event, "mousewheel")
  );
}
Try It Yourself

How It Works

Modern browsers take the wheel branch. The fallback exists only to explain old pages—new apps can omit mousewheel entirely.

🚀 Common Use Cases

  • Reading or migrating legacy scroll / zoom handlers that used mousewheel.
  • Teaching why non-standard events fail on Firefox and across OSes.
  • Comparing wheelDelta quirks with standard deltaY.
  • Documenting a migration checklist to wheel.
  • Not recommended: building new zoom, carousel, or map controls on mousewheel.

🔧 How It Works

1

User scrolls

Mouse wheel or trackpad gesture begins over the element.

Input
2

Legacy mousewheel?

Some engines may still dispatch the obsolete event (not Firefox).

Legacy
3

Standard wheel

Modern apps listen for wheel and read deltaX / deltaY / deltaMode.

Standard
4

Prefer wheel

Portable scrolling UX without non-standard mousewheel.

📝 Notes

  • MDN: Deprecated and Non-standard — avoid in production.
  • Firefox never implemented mousewheel; use wheel for cross-browser support.
  • wheelDelta sign and magnitude differ by browser and OS (documented extensively on MDN).
  • Not part of any specification—there is no standards track to revive it.
  • Related learning: mouseup, mousemove, addEventListener(), JavaScript hub.

Limited / Legacy Browser Support

mousewheel is a deprecated, non-standard event. Logos use the shared browser-image-sprite.png sprite from this project. Firefox never implemented it. Prefer the standard wheel event everywhere.

Deprecated · Non-standard

Element mousewheel

Do not build features on this event. Migrate listeners to wheel and deltaY / deltaX.

Legacy Not for new apps
Google Chrome Legacy support · prefer wheel
Avoid
Mozilla Firefox Never implemented mousewheel
Unavailable
Apple Safari Legacy support · prefer wheel
Avoid
Microsoft Edge Legacy Chromium path · prefer wheel
Avoid
Opera Legacy support · prefer wheel
Avoid
Internet Explorer Historic mousewheel support
Legacy
mousewheel Deprecated

Bottom line: Use wheel for portable scroll/zoom UX. Treat mousewheel as legacy-only documentation.

Conclusion

mousewheel is a deprecated, non-standard footnote in the scroll-event story. Learn it to migrate old code; ship the standard wheel event instead.

Continue with MozMousePixelScroll, DOMMouseScroll, addEventListener(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use addEventListener("wheel", …) for new scroll/zoom UX
  • Read deltaY / deltaX / deltaMode
  • Test trackpads and mice (gesture sizes differ)
  • Migrate legacy mousewheel listeners when you touch old code
  • Remember Firefox never had mousewheel

❌ Don’t

  • Build new features on mousewheel
  • Assume wheelDelta === ±120 everywhere
  • Expect Firefox to fire mousewheel
  • Treat non-standard events as future-proof
  • Overwrite onmousewheel if you still need multiple legacy listeners

Key Takeaways

Knowledge Unlocked

Five things to remember about mousewheel

Obsolete wheel signal—prefer the standard wheel event.

5
Core concepts
⚠️02

Deprecated

avoid new use

Status
🚫03

Non-standard

not in Firefox

Compat
📄04

wheelDelta

inconsistent

Quirk
🎯05

Use wheel

deltaY path

Modern

❓ Frequently Asked Questions

It is an obsolete, non-standard event that fired while a mouse wheel or similar device was operated. MDN marks it Deprecated and Non-standard. Prefer the standard wheel event instead.
No. Use addEventListener("wheel", …) with WheelEvent.deltaX / deltaY / deltaMode. mousewheel was never standardized and was never implemented by Firefox.
No. wheel is the standard DOM event. mousewheel is a legacy, non-standard name with inconsistent wheelDelta values across browsers and operating systems.
Historically Chromium-based browsers, Safari, Opera, and Internet Explorer shipped it. Firefox never implemented mousewheel. Do not rely on it for new code.
A WheelEvent (inherits from MouseEvent, UIEvent, and Event). Legacy code often reads wheelDelta / wheelDeltaX / wheelDeltaY.
Replace "mousewheel" listeners with "wheel". Prefer deltaY (and deltaX) over wheelDelta. Test trackpads and mice, and avoid assuming a fixed ±120 notch size.
Did you know?

MDN notes that wheelDelta meaning differs across Chrome, Safari, Opera, and operating systems—so even when mousewheel fired, apps could not rely on a single numeric scale. That inconsistency helped push the web toward the standard wheel event.

Next: MozMousePixelScroll

Learn the obsolete Firefox pixel-scroll event—and why wheel replaces it.

MozMousePixelScroll →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful