2012-03-20 129 views
2

我使用will_paginate創業板與Infinite Scroll jQuery Plugin相結合,機制工作得很好。 唯一的例外是顯示信息消息,何時加載新內容或何時已加載所有數據 - 此消息不顯示。will_paginate +無限滾動插件 - 不顯示「加載」消息

下面是will_paginate寶石產生我的分頁結構:

<div class="pagination"> 
    <span class="previous_page disabled">&#8592; Previous</span> 
    <em class="current">1</em> 
    <a rel="next" href="/articles?page=2">2</a> 
    <a href="/articles?page=3">3</a> 
    <a href="/articles?page=4">4</a> 
    <a class="next_page" rel="next" href="/articles?page=2">Next &#8594;</a> 
</div> 

這是Infinite Scroll plugin的設置:

$container.infinitescroll({ 
    navSelector : '.pagination', // selector for the paged navigation 
    nextSelector : '.pagination a', // selector for the NEXT link (to page 2) 
    itemSelector : '.box-item',  // selector for all items you'll retrieve 
    loading: { 
     finishedMsg: 'No more pages to load.', 
     img: 'http://i.imgur.com/6RMhx.gif' 
     } 
    }, 

    function(newElements) { 
     var $newElems = $(newElements).css({ opacity: 0 }); 
     $newElems.imagesLoaded(function(){ 
     $newElems.animate({ opacity: 1 }); 
     $container.masonry('appended', $newElems, true); 
     }); 
    } 
); 

一切都應該由手冊頁設置,但我不」不知道爲什麼,信息信息和加載程序沒有加載...

感謝每一個幫助!

+0

你有沒有解決辦法?我也有同樣的問題 – franklinexpress 2014-08-14 10:22:11

回答

0

代替

nextSelector : '.pagination a', // selector for the NEXT link (to page 2) 

使用

nextSelector : '.pagination a[rel="next"]', // selector for the NEXT link (to page 2) 

這可能會幫助你