0

我尝试用 jQuery 实现基本的无限滚动:

<!DOCTYPE html>
<html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
</head>

<body>


    <div>
        <div id="tweets">
            <script>
                for(var j=0; j<=99; j++)
                    document.write(j+'<br/>');
            </script>
        </div>
    </div>

    <script>
        var start = 0;
        var count = 100;

        $(window).scroll(function()
        {   
            if($(window).scrollTop() == $(document).height() - $(window).height())
            {
                start += count;
                for(var i=start; i<=start+count; i++)
                    $('div#tweets').append(i+'<br/>');
            }
        });
    </script>

</body>

但它不起作用?可能是什么问题?原始来源在这里

4

0 回答 0