加载了砌体的图像,对象#< Object>没有方法'imagesLoaded' [英] ImagesLoaded with Masonry, Object #<Object> has no method 'imagesLoaded'
问题描述
遇到此错误,尝试将Masonry与imageLoaded一起使用:
Getting this error, trying to use Masonry with imageLoaded:
对象#没有方法'imagesLoaded'"
"Object # has no method 'imagesLoaded'"
必要脚本的链接在我的标题中:
The links to the necessary scripts are in my header:
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script><script src="/js/masonry.pkgd.min.js" type="text/javascript"></script>
<script src="/js/imagesloaded.pkgd.min.js" type="text/javascript"></script>
下面是代码在页脚中的显示方式:
And here is how the code looks in my footer:
$(document).ready(function() {
$('#archive-post-container').imagesLoaded(function() {
$(this).masonry({
itemSelector : '.post',
columnWidth:344
});
});
});
编辑/附录: 将ImagesLoaded和Masonry的脚本标签放置在我需要它们的页面的实际.php文件中,而不是在header.php中,将这个错误发给我,来自ImagesLoaded: 未捕获的TypeError:undefined不是函数
EDIT / ADDENDUM: Placing the script tags for ImagesLoaded and Masonry in the actual .php file for the page I need them on, instead of in header.php gets me this error instead, coming from ImagesLoaded: Uncaught TypeError: undefined is not a function
不确定为什么将标记仅从移到标题的正下方会改变这种情况,但是至少现在我要进入imagesLoaded了?
Not sure why moving the tags just from the to just under the header would change this, but at least now I am getting to imagesLoaded?
推荐答案
请注意,根据
http://masonry.desandro.com/appendix.html#upgrading- from-v2
您可以直接在此处获取它:
You can get it directly here:
http://desandro.github.io/imagesloaded/
这篇关于加载了砌体的图像,对象#< Object>没有方法'imagesLoaded'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!