當鼠標滾輪在元素上滾動時,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("Mouse Wheel used!");
}
</script>
</body>
</html>
登錄后復制
以上就是當鼠標滾輪在HTML元素上滾動時執行腳本嗎?的詳細內容,更多請關注www.92cms.cn其它相關文章!






