我正在使用jQuery Masonry安装WordPress,它可以在每个浏览器中正常运行,但Safari(包括Win和OSX)。这可能与.load()
过早解雇的一些jQuery / WebKit问题有关吗?我是jQuery / JavaScript的新手,所以非常感谢任何帮助。
此页面在Safari中不起作用:http://tangomitstil.de/news/
虽然此页面(出于某种原因)确实:http://tangomitstil.de/info/unterricht/
这个问题与项目数量无关(我的开发版本遇到了相当大的测试帖子问题),@ font-face嵌入,图片使用或{{3 }}
以下是标题部分中调用的代码:
jQuery(window).load(function($) {
// We can only load masonry on window.load because of embedded swfobjects
jQuery('.content').masonry({
singleMode: true,
resizable: true,
animate: false
}); // initiate masonry
jQuery('.content').infinitescroll({
navSelector: "div.navigation",
// selector for the paged navigation (it will be hidden)
nextSelector: "div.navigation div.nav-previous a",
// selector for the NEXT link (to page 2)
itemSelector: ".content div.post",
// selector for all items you'll retrieve
loadingText: "Lädt weitere Beiträge..."
}, function(newElements) {
jQuery(this).masonry({
appendedContent: jQuery(newElements)
});
})
});
答案 0 :(得分:2)
尝试使用“DOM ready”事件,该事件在“load”事件(图像完成加载等)后触发。
jQuery有一个很好的快捷方式。而不是
jQuery(window).load(function() {
// ...
});
DO
jQuery(function() {
// ...
});
或者,简单地说:
$(function() {
// ...
});
当您不并行使用任何其他JS框架时,使用$
代替jQuery
安全且方便。