当鼠标滚轮在HTML中的元素上滚动时执行脚本?
在元素上滚动鼠标滚轮时,将触发onwheel属性。
示例
当鼠标滚轮在HTML中的元素上滚动时,您可以尝试运行以下代码来执行脚本-
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id = "myDIV" onwheel = "display()">This is demo text. Roll the mouse wheel here.</div>
<script>
function display() {
alert("使用鼠标滚轮!");
}
</script>
</body>
</html>热门推荐
10 幸福卡片祝福语英文简短
11 给长辈敬祝福语简短
12 宝宝祝福语诗意简短 古文
13 祝福语美甲店员工简短
14 项目总生日祝福语简短
15 对上司的简短祝福语
16 新老师祝福语 简短独特
17 新人结婚简短祝福语大全
18 祝福语简短创意闺蜜