HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ width:150px; height:150px; border:1px solid #8c8c8c; overflow: scroll; } </style> </head> <body> <p>'onwheel' event only works when you have pointing devices like mouse, trackpad etc.</p> <div> <h3>Wildlife</h3> <p>Wildlife traditionally refers to undomesticated animal species, but has come to include all organisms that grow or live wild in an area without being introduced by humans.</p> </div> <p>Div is wheeled <span id="point">0</span> times<p> <script> var x = document.getElementsByTagName("div")[0]; var count = 0; function myFunction(){ count += 1; document.getElementById("point").innerHTML = count; } x.addEventListener("wheel", myFunction); </script> </body> </html>
OUTPUT
×

Save as Private