I have found this pretty usefull function that tells you if the user scrolls up or down in his browser in pure javascript. I kind of get the first part where the functions triggers every time you scroll and where you ask if the number of pixels is bigger from the previous position than the new one (so a true or false answer expected).
What i don't get : why the function need a parameter (e) and the last part of the function where it says give the value of the old scroll the new scroll value ?
Thank you if you take time to read me, cheers :*
window.onscroll = function isBottom(e) {
// print "false" if direction is down and "true" if up
console.log(this.oldScroll > this.scrollY);
this.oldScroll = this.scrollY;
}