2012-11-01 24 views
0

我有一個<div id="content" class="clearfix"></div>它自我填充從我的服務器上單獨的目錄中的圖像URL列表。如何填充無限滾動與1目錄中的圖像?

下面是現場直播網址:http://ilovesmallies.com/forum/showcase.php

我想在這個div利用無限滾動和磚石插件。

不過,我不確定如何朝着這個腳本圖像的URL列表點...

這裏是如何現在編碼並不起作用。

<script> 
    $(function(){ 

    var $container = $('#content'); 

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

    $container.infinitescroll({ 
     navSelector : '#content', // selector for the paged navigation 
     nextSelector : '#content a', // selector for the NEXT link (to page 2) 
     itemSelector : '.box',  // 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 }); 
      $container.masonry('appended', $newElems, true); 
     }); 
     } 
    ); 

    }); 
</script> 

回答

0

你能渲染你所有的圖像嗎?

我最喜歡的辦法就是先拼版圖片項,然後應用:

itemSelector < --->類的每個項目。 (在你的情況,也可以是每個圖像)

navSelector < --->分頁元素的ID

nextSelector < --->在分頁點元素(鏈接到下一頁)

我只是讓分頁顯示沒有。

+0

你是什麼意思渲染我所有的圖像? 有無論如何,你可以舉一個例子如何分頁的代碼? 你怎麼讓他的分頁顯示沒有? – MrSeth