美文网首页
页面滚动到底部加载内容

页面滚动到底部加载内容

作者: Gino_Li | 来源:发表于2019-04-10 20:00 被阅读0次
1554696748(1).png
原理:

scrollTop+clientHeight>=scrollHeight

var scrollTop = document.documentElement.scrollTop,
      clientHeight = document.documentElment.clientHeight,
      scrollHeight = document.documentElement.scrollHeight;

if(scrollTop+clientHeight>=scrollHeight){
      //进行ajax请求
}

相关文章

网友评论

      本文标题:页面滚动到底部加载内容

      本文链接:https://www.haomeiwen.com/subject/zhsuiqtx.html