无法让jQuery Masonry + Infinite Scroll在Safari和Chrome上工作
问题描述:
嗨我试图设置一个使用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) }); }
);
});
任何帮助将非常感激。
答
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时,我想(我不知道脚本但这是他们”什么在文档中说)
由于LekisS - columnWidth似乎已经完成了这个把戏。 – Jason 2011-03-16 16:57:23