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="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: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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)