ImagesLoaded with Masonry, Object #<Object>没有

ImagesLoaded with Masonry, Object #lt;Objectgt; has no method #39;imagesLoaded#39;(ImagesLoaded with Masonry, Object #lt;Objectgt;没有方法“imagesLoaded)

本文介绍了ImagesLoaded with Masonry, Object #<Object>没有方法“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="aHR0cDovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktbGF0ZXN0Lm1pbi5qcw==" type="text/javascript"></script><script src="L2pzL21hc29ucnkucGtnZC5taW4uanM=" type="text/javascript"></script>
<script src="L2pzL2ltYWdlc2xvYWRlZC5wa2dkLm1pbi5qcw==" 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:Uncaught TypeError: undefined is not a function

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?

推荐答案

请注意,ImageLoaded 不再包含在最新的 Masonry 发行版中,每

Note that ImagesLoaded is no longer included in the latest Masonry distribution, per

http://masonry.desandro.com/appendix.html#upgrading-从-v2

你可以直接在这里获取:

You can get it directly here:

http://desandro.github.io/imagesloaded/

这篇关于ImagesLoaded with Masonry, Object #&lt;Object&gt;没有方法“imagesLoaded"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:ImagesLoaded with Masonry, Object #&lt;Object&gt;没有