JavaScript Element mousewheel Event

Beginner
5 min read
Updated: Nov 2026
3 examples
Event

Definition

In JavaScript, the obsolete mousewheel event fired while a mouse wheel or similar device was operated (MDN). It was never part of any standard and was never implemented by Firefox. Prefer wheel.

Register a listener with addEventListener. Check readiness and browser support before you rely on this event.

Syntax

Listen for mousewheel. Start with this line.

JavaScript
addEventListener("mousewheel", fn)
CallWhat it does
addEventListener("mousewheel", fn)Primary signature.

Built into the browser. Listen with el.addEventListener("mousewheel", …) — no import required.

Library declarations
JavaScript
addEventListener("mousewheel", fn)

Parameters

ParameterDescription
Handler propOptional. onmousewheel

Return Value

Return ValueDescription
*Fires as an Element event (listener receives the Event object).

JavaScript Examples

Example 1 — Legacy mousewheel Log

Study-only: see if the obsolete event fires in your browser.

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

stage.addEventListener("mousewheel", () => {
  console.log("mousewheel fired (legacy)");
});

// May stay silent in Firefox (MDN)
Try It Yourself

How It Works

  1. Legacy name. Not for new projects (Deprecated · Non-standard).
  2. Firefox gap. MDN: Firefox never implemented mousewheel.
  3. Study use. Helps you recognize old tutorials and codebases.
  4. Next step. Replace with wheel immediately in real apps.

Example 2 — Prefer Standard wheel

MDN replacement: log deltaY / deltaX / deltaMode.

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

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

How It Works

  1. Standard event. Portable across modern browsers.
  2. deltaY / deltaX. Prefer these over legacy wheelDelta.
  3. deltaMode. Tells whether deltas are pixels, lines, or pages.
  4. Learn more. Full tutorial: wheel.

Example 3 — Migrate with a Safe Fallback

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

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

function onScrollGesture(event, source) {
  const dy = source === "wheel" ? event.deltaY : -event.wheelDelta;
  console.log(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

  1. Feature-detect. "onwheel" in window picks the modern path.
  2. Normalize roughly. Legacy wheelDelta often has the opposite sign of deltaY.
  3. Do not over-trust. Exact amounts still vary — keep logic tolerant.
  4. Default today. Almost all student browsers take the wheel branch.

Browser Support

Element mousewheel is Deprecated and Non-standard on MDN. It was never standardized and was never implemented by Firefox. Do not add it to new code — migrate to wheel.

✓ Deprecated · Non-standard

Element mousewheel

Obsolete legacy wheel event. Prefer the standard wheel event with deltaX / deltaY.

Legacy Deprecated
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Android WebView Supported · Modern WebView
Full support
mousewheel Avoid

Bottom line: Historical Chromium/Safari/IE only. Firefox never shipped it. Use wheel for portable apps.

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.

Next: MozMousePixelScroll

Learn another Firefox-only legacy scroll event (and keep preferring wheel).

MozMousePixelScroll tutorial →

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.

11 people found this page helpful