jquery: An autoscroll function for a page with ajax content loading
===

I'm trying to write a function to autoscroll a page with infinite scrolling. It partially works, but on such pages as facebook, it stops unexpectedly at a certain point. Any suggestion?

    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);
        }
    }

thanks


