移动端兼容性

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/besttoby01/article/details/84777320

1. 移动端 部分安卓手机不支持 scrollTo();

2. 部分安卓机 使用滚动的时候 加5点高度

var that = this;
      const box = document.getElementById("box");
      // 滚动条到底部
      box.onscroll = function() {
        var scrollTop = box.scrollTop;
        var windowHeight = box.clientHeight;
        var scrollHeight = box.scrollHeight;
        if (scrollTop + windowHeight+5 >= scrollHeight) {
          if (that.hasMore) {
            that.page++;
            that.earnings();
          }
        }
      };

猜你喜欢

转载自blog.csdn.net/besttoby01/article/details/84777320