判断页面滑动到底部

版权声明:如需转载请参阅《转载说明》 https://blog.csdn.net/automation13/article/details/81674925
window.addEventListener('scroll', function(){
    const scrollHeight = document.body.scrollHeight || document.documentElement.scrollHeight;
    const clientHeight = document.body.clientHeight || document.documentElement.scrollHeight;
    const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
    if(scrollTop >= scrollHeight - clientHeight){
        console.log('页面滑动到底部')
    }
})

猜你喜欢

转载自blog.csdn.net/automation13/article/details/81674925
今日推荐