HTML事件属性onwheel
2018-01-05 13:58 更新
HTML事件属性onwheel
触发 onwheel
属性事件当鼠标滚轮向上或向下滚动时。
HTML5中的新功能
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>
以上内容是否对您有帮助:
更多建议: