判断滚动条滑到底部触发事件

$(document).on("scroll", function () {
//真实内容的高度
var pageHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight);
//视窗的高度
var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
//隐藏的高度
var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
//判断加载视频,文章,回答,医生
if(pageHeight - viewportHeight - scrollHeight <=0){
//事件
}
});

posted on 2017-11-14 15:50  creatP  阅读(377)  评论(0编辑  收藏  举报

导航