📜  检查用户滚动顶部或底部 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:12.735000             🧑  作者: Mango

代码示例1
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;
      }
   });