window.addEventListener('scroll', this.handleScroll);
function handleScroll() {
//判断滚动到底部
if ($(window).scrollTop() >=$(document).height() - $(window).height()) {
console.log(132456)
}
}
本文介绍了一种使用JavaScript监听滚动条是否到达页面底部的方法。通过为window对象添加scroll事件监听器,在滚动到页面底部时触发特定操作。适用于网页加载更多内容等应用场景。
window.addEventListener('scroll', this.handleScroll);
function handleScroll() {
//判断滚动到底部
if ($(window).scrollTop() >=$(document).height() - $(window).height()) {
console.log(132456)
}
}
转载于:https://www.cnblogs.com/Basu/p/9149457.html
2277
4048
2万+
1万+
726

被折叠的 条评论
为什么被折叠?