2011-03-16 49 views
2

嗨我試圖設置一個使用jQuery Masonry和Infinite scroll的網站,但我似乎無法讓它在OSX或Chrome上運行。無法讓jQuery Masonry + Infinite Scroll在Safari和Chrome上工作

的開發網站http://bit.ly/hYJ3Cq

我不是在控制檯中得到任何JavaScript錯誤。

事情我已經嘗試:

  • 使用舊的jQuery庫
  • 移動JS砌築的div
  • 內設置圖像寬度/高度頭,而不是頁腳
  • 加式=「TEXT/javascript「腳本標記
  • 驗證html
  • 在jQuery(window).load(和jQuery(document).ready(

這是我與工作的代碼非常相似,演示代碼工作正常:

jQuery(window).load(function(){ 

    jQuery('.hfeed').masonry({ 
     singleMode: true, 
     itemSelector: '.box' 
    }); 

    jQuery('.hfeed').infinitescroll({ 
     navSelector : '.pagination', // selector for the paged navigation 
     nextSelector : '.pagination .next', // selector for the NEXT link (to page 2) 
     itemSelector : '.box',  // selector for all items you'll retrieve 
     loadingImg : '/wp-content/themes/sprppl/images/loader.gif', 
     loadingText : "Loading...", 
     donetext : 'No more pages to load.', 
     debug: false, 
     errorCallback: function() { jQuery('#infscr-loading').animate({opacity: .8},2000).fadeOut('normal'); } 
     }, 
     // call masonry as a callback 
     function(newElements) { jQuery(this).masonry({ appendedContent: jQuery(newElements) }); } 
    );  

    }); 

任何幫助將非常感激。

回答

1

http://desandro.com/demo/masonry/docs/infinite-scroll.html

查看 「的tumblr問題」。你應該設置圖像大小的標籤(在<img/>不是<div/>)或使用的setTimeout()

// call masonry as a callback, after 1000 milliseconds 
function(newElements) { 
    setTimeout(function() { 
    $wall.masonry({ appendedContent: $(newElements) }); 
    }, 1000); 
} 

你也應該設定一個columnWidth時,我想(我不知道腳本但這是他們」什麼在文檔中說)

+0

由於LekisS - columnWidth似乎已經完成了這個把戲。 – Jason 2011-03-16 16:57:23

相關問題