onwheel Property triggered when the mouse wheel scrolls up or down on the element. You can try running the following code to achieve onwheel property -
<!DOCTYPE html> <html> <body> <h3 id = "myid" onwheel = "mouseWheel()"> This is demo heading. </h3> <p>Click above and use mouse wheel to change the heading color.</p> <script> function mouseWheel() { document.getElementById("myid").style.color = "red"; } </script> </body> </html>
The above is the detailed content of Execute script when mouse wheel scrolls up or down on HTML element?. For more information, please follow other related articles on the PHP Chinese website!