jquery masonry是否重复了imagesLoaded函数? [英] Does jquery masonry duplicates the imagesLoaded function?

查看:103
本文介绍了jquery masonry是否重复了imagesLoaded函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是javascript插件的新手。所以这是我的问题(关于jQuery砌体)。



我注意到最新的masonry.js里面有imagesLoaded。
然后我也注意到砌体网站建议用户下载imagesLoaded插件。




  • Q1)这是重复,还是做两个都需要存在才能使这个
    工作?

  • Q2)我是否需要包括&引用单独的
    imagesLoaded.js插件文件以便使用它?



Side注意:我在得出这个结论之后注意到我的砌体对象在第一次加载时很好,但在后续加载时,当我尝试初始化时,砌体会抛出错误。虽然无论如何,imagesLoaded似乎运行得很好,不包括imagesLoaded插件文件本身。




  • 更新*



我看到的错误是由于我在用新内容更新之前没有删除砌体内容。所以这不是更新的imagesLoaded.js的问题

解决方案

jQuery Masonry包含一个过时版本的jQuery imagesLoaded插件v1。 1.0。



截至2012年7月30日,最新版本的jQuery imagesLoaded插件是v2.0.1
https://github.com/desandro/imagesloaded/blob/master/jquery.imagesloaded.js



您可以通过在jQuery Masonry之后包含脚本来将jQuery映像从1.1.0升级到2.0.1。



但是,我不确定升级是否会破坏任何东西。但是从你的问题看来它确实如此。



更新



jQuery Masonry和jQuery imagesLoaded是不同的项目同一个人,desandro。



由于jQuery Masonry建议您使用jQuery imagesLoaded,因此他将其作为源的一部分,因此您不必导入另一个文件。 / p>

导入一个脚本而不是两个脚本更容易。



当你包含最新版本的jQuery imagesLoad时,导入单独的脚本,你将覆盖对函数调用的旧引用。



最新版本的jQuery imagesLoad具有更清晰的代码但两个版本似乎具有相同的功能。


I am new to javascript plugins. So this is my question pertaining to it (with respect to the jQuery masonry).

I noticed the latest masonry.js has imagesLoaded inside it. Then I also noticed that the masonry website suggests users download the imagesLoaded plugin.

  • Q1) Is this a duplication, or do both need to exist in order for this to work?
  • Q2) Do I need to include & reference the separate imagesLoaded.js plugin file in order to use it?

Side Note: I came to this conclusion after noticing that my masonry object loads just fine the FIRST time, but on subsequent loads masonry throws an error when i try to initialize it. Though regardless, the imagesLoaded seems to run just fine WITHOUT including the imagesLoaded plugin file itself.

  • updated *

The bug that I was seeing was due to my not 'deleting' the masonry contents before updated it with new content. So this is not an issue with the updated imagesLoaded.js

解决方案

jQuery Masonry includes an outdated version of the jQuery imagesLoaded plugin v1.1.0.

As of July 30, 2012, the lastest version of jQuery imagesLoaded plugin is v2.0.1 https://github.com/desandro/imagesloaded/blob/master/jquery.imagesloaded.js

You can upgrade jQuery imageloaded from version 1.1.0 to 2.0.1 by including the script after jQuery Masonry.

However, I'm not sure if the upgrade will break anything. But from your question it seems that it does.

Update

jQuery Masonry and jQuery imagesLoaded are different projects by the same person, desandro.

Since jQuery Masonry recommends that you use jQuery imagesLoaded, he make it part of the source so you don't have to import another file.

It easier to import one script instead of two.

When you include the lastest version of jQuery imagesLoad, by importing the seperate script, you're overwriting the old reference to the function call.

The lastest versions of jQuery imagesLoad has cleaner code but both version seem to have the same functionality.

这篇关于jquery masonry是否重复了imagesLoaded函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆