問題描述
遇到此錯(cuò)誤,嘗試將 Masonry 與 imageLoaded 一起使用:
Getting this error, trying to use Masonry with imageLoaded:
對(duì)象#沒有方法'imagesLoaded'"
"Object # has no method 'imagesLoaded'"
必要腳本的鏈接在我的標(biāo)題中:
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 的腳本標(biāo)簽放在我需要它們的頁面的實(shí)際 .php 文件中,而不是放在 header.php 中,這會(huì)導(dǎo)致我出現(xiàn)此錯(cuò)誤,來自 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
不知道為什么將標(biāo)簽從標(biāo)題移動(dòng)到標(biāo)題下方會(huì)改變這一點(diǎn),但至少現(xiàn)在我正在使用 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?
推薦答案
請(qǐng)注意,ImageLoaded 不再包含在最新的 Masonry 發(fā)行版中,每
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/
這篇關(guān)于ImagesLoaded with Masonry, Object #<Object>沒有方法“imagesLoaded"的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!