觸發(fā) onwheel
屬性事件當(dāng)鼠標(biāo)滾輪向上或向下滾動(dòng)時(shí)。
onwheel
屬性是HTML5中的新特性。
<element onwheel="script or Javascript function name">
所有HTML元素
onwheel |
Yes | Yes | Yes | Yes | Yes |
<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
border: 1px solid black;
}
</style>
</head>
<body>
<div id="myDIV" onwheel="myFunction()">
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. 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. 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>
function myFunction() {
console.log("wheel");
}
</script>
</body>
</html>
更多建議: