判断滚动条滑到底部触发事件(实例讲解)
时间:2022-02-13 10:49:06|栏目:JavaScript代码|点击: 次
实例如下所示:
$(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){
//事件
}
});
上一篇:IE8/IE9下Ajax缓存问题
栏 目:JavaScript代码
本文标题:判断滚动条滑到底部触发事件(实例讲解)
本文地址:http://www.codeinn.net/misctech/193259.html






