Google+ APIを使ってみた(JavaScript編)

source : scrolloader.js

<div id="scrolloader" data-nextpage="" data-url="/ajax/sample.php"></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="/js/scrolloader.js"></script>
<script type="text/javascript">
//<![CDATA[
    var sl = null;
    $(function(){
        sl = new scrolloader({
            target : $('#scrolloader'),
            iniload : true,
            offset : 500,
            customhtml : function (data) {
                var html = '';
                for (var i = 0; i < data.length; i++) {
                    var even = (i%2 == 1) ? true : false;
                    html += '<div style="padding:100px 0; text-align:center; background-color:#' + (even ? 'f9f9f9' : 'fff') + '; border-top:1px solid #ccc;">' + data[i].id + '</div>';
                }
                return html;
            }
        });
    });

    $(window).scroll(function(){
        sl.scroll();
    });
//]]>
</script>