您的位置:MYSQL中文网 > HTML事件属性onwheel

HTML事件属性onwheel

2023-10-09 00:30 HTML参考手册

 HTML事件属性onwheel

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>

Click to view the demo



阅读全文
以上是MYSQL中文网为你收集整理的 HTML事件属性onwheel全部内容。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
相关文章
© 2024 MYSQL中文网 mysqlcn.com 版权所有 联系我们
桂ICP备12005667号-29 Powered by CMS