I have a webpage where the body has css
body {
overflow-x: hidden;
overflow-y: hidden;
}
I do not want to show the scroll bar.
I want to run some javascript when the user scrolls down, so I did this:
<script>
document.addEventListener("scroll", function (e) {
console.log("scrolling engage");
if (e.detail > 0) {
// do things ...
}
return false;
}, true);
</script>
I also tried setting onscroll
to the function. The problem is that this event does not fire, I then found this page which says the event only fires when there is a scroll bar, however I don't want a scroll bar.
How do I detect the scroll wheel without showing the scroll bar? I do not want to use jQuery.