mouse scroll event html
snippet in html

mouse scroll event html

user9316


 window.onscroll = function() {myFunction()};

function myFunction() {

    if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
    document.getElementById("myP").className = "test";
  } else {
    document.getElementById("myP").className = "";

    }
}
 

javascript detect scroll wheel

user3684

element.onscroll = function() {
  // Code here
}