I\'m designing a very simple web page (HTML only), the only \"feature\" I want to implement is to do something when the user scrolls down the page, is there a way to capture
/**
* This function will determine if a client mousewheel is scrolling up or down.
*/
//window.addEventListener("load", eScroll);
function eScroll() {
window.addEventListener('mousewheel', (event)=> {
let originalEvent = event.wheelDeltaY;
if (event.wheelDeltaY >= 0) {
console.log('Scroll up');
}
else {
console.log('Scroll down');
}
});
}
window.addEventListener("load", scrollDown);
function scrollDown() {
window.addEventListener('mousewheel', (event)=> {
if (event.wheelDeltaY <= 0) {
console.log(event.wheelDeltaY);
console.log('Mousewheel has scrolled down');
}
})
}
window.addEventListener("load", scrollUp);
function scrollUp() {
window.addEventListener('mousewheel', (event)=> {
if (event.wheelDeltaY > 0) {
console.log(event.wheelDeltaY);
console.log('Mousewheel has scrolled up');
}
})
}