本文主要为大家带来一篇判断滚动条滑到底部触发事件的实例讲解。具有很好的参考价值。一起跟随小编过来看看吧,希望对大家有所帮助,希望能帮助到大家。
实例如下所示:
$(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){
//事件
}
});相关推荐:










