0

ページが長すぎるため、ユーザーが下にスクロールしているときにコンテンツを自動ロードするために、オンラインの「jqueryscrollpagination」という名前のインターネットのスクリプトを使用します。ライブリンク - http://www.arif-khan.net/project/chuck/jobOpening.html

私の問題は、一番下をスクロールした後、同じコンテンツが何度も表示されることです。どうすれば修正できますか?

Javascript コード -

    <script type="text/javascript">
    $(function(){
$('#content').scrollPagination({
    'contentPage': 'more_content.html', // the url you are fetching the results
    'contentData': {}, // these are the variables you can pass to the request, for example: children().size() to know which page you are
    'scrollTarget': $(window), // who gonna scroll? in this example, the full window
    'heightOffset': 10, // it gonna request when scroll is 10 pixels before the page ends
    'beforeLoad': function(){ // before load function, you can display a preloader div
        $('#loading').fadeIn(); 
    },
    'afterLoad': function(elementsLoaded){ // after loading content, you can use this function to animate your new elements
         $('#loading').fadeOut();
         var i = 0;
         $(elementsLoaded).fadeInWithDelay();
         if ($('#content').children().size() > 100){ // if more than 100 results already loaded, then stop pagination (only for testing)
            $('#nomoreresults').fadeIn();
            $('#content').stopScrollPagination();
         }
    }
});

// code for fade in element by element
$.fn.fadeInWithDelay = function(){
    var delay = 0;
    return this.each(function(){
        $(this).delay(delay).animate({opacity:1}, 200);
        delay += 100;
    });
};

 });
 </script>

& 別のスクリプト ファイルも使用します。ここをチェック - http://www.arif-khan.net/project/chuck/scripts/scrollpagination.js

4

1 に答える 1