首页 > 其他 > 详细

滚动到页面底部触发分页事件

时间:2017-10-14 15:45:10      阅读:244      评论:0      收藏:0      [点我收藏+]

$(window).scroll(function () {
var scrollTop = $(this).scrollTop(); // 页面卷上去的高度
var windowHeight = document.body.clientHeight; // 当前屏幕上页面的高度
var docHeight = $(document).height(); // 文档的高度
// 表示,如果滑到距离底部将近50px的时候,开始触发事件
if (docHeight - (scrollTop + windowHeight) < 50 ) {
// do something
}
});

滚动到页面底部触发分页事件

原文:http://www.cnblogs.com/Loveonely/p/7667378.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!