Home >Web Front-end >HTML Tutorial >Execute script when mouse wheel scrolls over HTML element?
The onwheel property fires when the mouse wheel scrolls over the element.
You can try running the following code to execute the script when the mouse wheel scrolls over an element in HTML -
<!DOCTYPE html> <html> <head> </head> <body> <div id = "myDIV" onwheel = "display()">This is demo text. Roll the mouse wheel here.</div> <script> function display() { alert("Mouse Wheel used!"); } </script> </body> </html>
The above is the detailed content of Execute script when mouse wheel scrolls over HTML element?. For more information, please follow other related articles on the PHP Chinese website!