2013-02-13 116 views
0

我正在使用以下代碼觸發同位素砌體上的infinitescroll,但是如何使用「單擊以加載更多帖子」,而不是「手動觸發器」。我嘗試從互聯網上的解決方案實施,但他們不適合我。謝謝。手動觸發infinitescroll

/*--------------------------------------------------------------------------------*/ 
/* infinitescroll 
/*--------------------------------------------------------------------------------*/ 
jQuery(document).ready(function($) { 
    var $container = $('.masonry'); 
    $container.imagesLoaded(function(){ 
    $container.isotope({ 
     itemSelector : '.item' 
    }); 
}); 
$container.infinitescroll({ 
     // selector for the paged navigation 
     navSelector : '.post-nav',  
     // selector for the NEXT link (to page 2) 
     nextSelector : '.post-nav .prev-post a', 
     // selector for all items you'll retrieve 
     itemSelector : '.item',  
     loading: { 
      finishedMsg: 'No more pages to load.', 
      img: 'http://i.imgur.com/qkKy8.gif' 
     } 
    }, 
    function(newElements) { 
     var $newElems = $(newElements).css({ opacity: 0 }); 
     $newElems.imagesLoaded(function() { 
      $newElems.animate({ opacity: 1 }); 
      $container.isotope('appended', $(newElements)); 
      $container.isotope('reLayout'); 
     }); 
    }); 
}); 
+0

'$ container.infinitescroll( '找回');'? – BenM 2013-02-13 18:47:46

回答

5

假設你正在使用this plugin,下面應該工作手動觸發檢索:

$container.infinitescroll('retrieve');