html tutorial - onmousewheel Attribute in HTML - html5 - html code - html form

Onmousewheel attribute in html

Learn html - html tutorial - Onmousewheel attribute in html - html examples - html programs

  • The onmousewheel attribute triggers when the mouse wheel is scroll either up or down over the element.

Syntax for onmousewheel attribute in HTML:

<element onmousewheel="script">

Applies To:

Element Attribute
All HTML elements onmousewheel

Attribute Values:

Value Description
script The script can run on onmousewheel

Sample Coding for onmousewheel Attribute in HTML:

Tryit<!DOCTYPE html>
        <title>Wikitechy onmousewheel attribute</title>
        <p onmousewheel="mouseWheel(this)">
          Scroll mouse wheel to check onmousewheel Event.<br>
          Learn to Code in Wikitechy.</p>
          function mouseWheel (obj)
  = "red";

Code Explanation for onmousewheel Attribute in HTML:

onmousewheel Attribute Code Explanation

  1. onmouseWheel attribute used to trigger an event when the mouse wheel scroll over to the specified element.
  2. mouseWheel JavaScript function used to change the text color to red.

Output for onmousewheel Attribute in HTML:

onmousewheel Attribute Tag Output

  1. The output shows "Scroll mouse wheel to check onmousewheel Event. in default (Black) color.
  2. onmousewheel Attribute Tag Output

  3. Once we press mouse button over the text the mouseWheel() function called and the text color will be changed to red.

Browser Support for onmousewheel Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to onmousewheel attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.