📌  相关文章
📜  javascript 到达页面底部 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:30.731000             🧑  作者: Mango

代码示例1
function getDocHeight() {    // $(document).height() value depends on browser
    var D = document;
    return Math.max(
        D.body.scrollHeight, D.documentElement.scrollHeight,
        D.body.offsetHeight, D.documentElement.offsetHeight,
        D.body.clientHeight, D.documentElement.clientHeight
    );
}
$(window).scroll(function() {
       if($(window).scrollTop() + $(window).height() == getDocHeight()) {
           alert("bottom!");
       }
});