用户向下滚动时自动垂直展开

Autoexpand vertically when user scrolls down

本文关键字:垂直 滚动 用户      更新时间:2023-09-26

我想要一个在用户向下滚动页面时添加大小为100px x 100px的方形div框的网站。灵感:http://ohlandmusic.com/

只需沿着这几行代码

$(window).scroll(function() {
    if($(window).scrollTop() == $(document).height() - $(window).height()) {
        $('body').append($('<div class="b100x100"/>'));
        //append more here
    }
}

这个处理程序应该放在页面初始化代码中。

有关更好的方法,请查看此处:http://www.jquery4u.com/tutorials/jquery-infinite-scrolling-demos/

对于SO上的类似问题,也有很多不同的答案。