onwheel = myFunction(); - Javascript DOM Event

Javascript examples for DOM Event:Element Event Attribute

Description

The onwheel event occurs when the mouse wheel is rolled up or down over an element.

Summary

Bubbles Yes
Cancelable Yes
Supported HTML tags: All HTML elements

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {//www .  j a  v a2 s.co m
    border: 1px solid black;
}
</style>
</head>
<body>

<div id="myDIV">
This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
</div>

<script>
document.getElementById("myDIV").onwheel = function() {myFunction()};

function myFunction() {
    document.getElementById("myDIV").style.fontSize = "35px";
}
</script>

</body>
</html>

Related Tutorials