首页 > 其他分享 >[jQuery]判断页面是否滚动到底部

[jQuery]判断页面是否滚动到底部

时间:2023-02-08 15:01:35浏览次数:38  
标签:jQuery 滚动 viewHeight var contentHeight scrollHeight 页面

 

    $(this).scroll(function () {
        var viewHeight = document.body.clientHeight; //可见高度
        var contentHeight = $(".container").get(0).scrollHeight  //内容高度  
        var scrollHeight = $(this).scrollTop(); //滚动高度 
        if (viewHeight + scrollHeight >= contentHeight) {
            alert("到达底部了");
        }
    })

 

目前测试UC、QQ、华为浏览器,判断不生效。

标签:jQuery,滚动,viewHeight,var,contentHeight,scrollHeight,页面
From: https://www.cnblogs.com/ximu1009/p/17082999.html

相关文章