![]() |
Definition and UsageThe The Applies toThe
Browser SupportThe numbers in the table specify the first browser version that fully supports the event attribute. |
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
}
</style>
</head>
<body>
<div id="myDIV" onwheel="myFunction()">This example demonstrates how to assign an "onwheel" event event to a DIV element. Roll the mouse wheel over me - either up or down!</div>
<p>A function is triggered when you roll the mouse wheel over div. The function sets the font-size of div to 35 pixels.</p>
<p><strong>Note:</strong> The onwheel event is not supported in Internet Explorer or Safari.</p>
<script>
function myFunction() {
document.getElementById("myDIV").style.fontSize = "35px";
}
</script>
</body>
</html>
html onwheel attribute |
How to Execute a JavaScript when the user rolls the mouse wheel over a <div> element - HTML onwheel Attribute | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 39 |
Reffered: https://www.w3schools.com/tags/att_onwheel.asp