scroll - jquery滚动到页面底部问题
本文介绍了scroll - jquery滚动到页面底部问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
源码:
$(window).scroll(function () {
var scrollTop = $(this).scrollTop()
var scrollHeight = $(document).height()
var windowHeight = $(this).height()
console.log(`scrollTop: ${scrollTop}`)
console.log(`windowHeight: ${windowHeight}`)
console.log(`scrollHeight: ${scrollHeight}`)
})
为啥当页面滚动到底部时, scrollTop + windowHeight
的总大小 [大于] scrollHeight
, 不是应该相等才对吗?
解决方案
@yhhwpp 网上流传滚动到底部ajax加载条件不就是 scrollTop + windowHeight = scrollHeight么?
这篇关于scroll - jquery滚动到页面底部问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文