Detecting scroll direction

It can be detected by storing the previous scrollTop value and comparing the current scrollTop value with it. JavaScript : var lastScrollTop = 0; // element should be replaced with the actual target element on which you have applied scroll, use window in case of no target element. element.addEventListener(“scroll”, function(){ // or window.addEventListener(“scroll”…. var st … Read more