2013-06-28 95 views
0

您有沒有經驗的人使用Masonry.js和JQuery scrollPagination?砌體和滾動頁面

加載後圖像重疊更多。

Check this website

那是無論如何要解決這一問題?

+0

沒有答案,但你可能想試試[Isotope](http://isotope.metafizzy.co)。這是Masonry稍微聰明的兄弟,並且我個人發現它更容易定製和添加功能。 – giorgio

回答

0

我已使用MasonryInfinite Scroll plugin。它很容易實現。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script src="http://dl.dropbox.com/u/33213779/jquery.masonry.min.js"></script&gt; 
<script src="http://masonry.desandro.com/js/jquery.infinitescroll.min.js"></script&gt; 
<script> 
$(function(){ 
    var $grid = $('#posts'); 

    $grid.imagesLoaded(function(){ 
     $grid.masonry({ 
      itemSelector : '.item',  
      columnWidth: 250 
     }); 
    }); 

    $grid.infinitescroll({ 
     navSelector : '#footer', // selector for the paged navigation 
     nextSelector : '#footer a', // selector for the NEXT link (to page 2) 
     itemSelector : '.item',  // selector for all items you'll retrieve 
     loading: { 
     finishedMsg: 'No more pages to load.', 
     img: 'http://i.imgur.com/6RMhx.gif' 
    } 
     }, 
     // trigger Masonry as a callback 
     function(newElements) { 
    // hide new items while they are loading 
    var $newElems = $(newElements).css({ opacity: 0 }); 
    // ensure that images load before adding to masonry layout 
    $newElems.imagesLoaded(function(){ 
     // show elems now they're ready 
     $newElems.animate({ opacity: 1 }); 
     $grid.masonry('appended', $newElems, true); 
    }); 
     } 
    ); 

    }); 
</script>