Answers for "check if user scroll top or bottom"

0

check if user scroll top or bottom

var lastScrollTop = 0, delta = 5;
   $(window).scroll(function () {
      var nowScrollTop = $(this).scrollTop();
      if (Math.abs(lastScrollTop - nowScrollTop) >= delta) {
         if (nowScrollTop > lastScrollTop) {
            // SCROLLING Down
         } else {
            //scroll top
            
         }
         lastScrollTop = nowScrollTop;
      }
   });
Posted by: Guest on February-02-2021

Browse Popular Code Answers by Language