onwheel?當鼠標滾輪在元素上向上或向下滾動時觸發屬性。您可以嘗試運行以下代碼來實現onwheel?屬性 –
示例
<!DOCTYPE html> <html> <body> <h3 id = "myid" onwheel = "mouseWheel()"> This is demo heading. </h3> <p>Click above and use mouse wheel to change the heading color.</p> <script> function mouseWheel() { document.getElementById("myid").style.color = "red"; } </script> </body> </html>
登錄后復制
以上就是當鼠標滾輪在HTML元素上向上或向下滾動時執行腳本?的詳細內容,更多請關注www.92cms.cn其它相關文章!