具有ajax内容加载的页面的自动滚动功能

时间:2012-07-18 14:41:03

标签: jquery scroll

我正在尝试编写一个函数来自动滚动具有无限滚动的页面。它部分有效,但在Facebook这样的页面上,它会在某个时刻意外停止。有什么建议吗?

function scroll() {
    if ($bottom <= ($(document).height() + $(window).height() + 100)) {
        $('html, body').animate({
            scrollTop: $bottom
        }, 2500, 'linear', function() {
            console.log(($(document).height() + $(window).height() + 100) + ' ' + $bottom);
            $bottom = $bottom + 100;
            scroll();
        });
    } else {
        $('html, body').stop(true);
    }
}

感谢

0 个答案:

没有答案