I have a div that has an onScroll
handler and I need to know the direction where the user will scroll(to top or bottom).
My html:
<body>
<div>
Section1
</div>
<div>
Section1
</div>
</body>
My js:
document.addEventListener('scroll', (event) => {
if(....){
console.log(user scroll to top);
}else {
console.log(user scroll to bottom);
}
});
What I should write instead ...