未定义函数 - 文档和窗口对象混淆



我试图在jquery中声明一个简单的函数并调用它,这一直让我感到困惑。

我收到此错误:

调整大小所有曼索里未定义项

如何正确声明? 这是我的jQuery脚本:

jQuery(function ($) {
var resizeAllMansonryItems = function (selector_to_get_height) {
var allItems = $('.h4a-brick');
/*
* Loop through the above list and execute the spanning function to
* each list-item (i.e. each masonry item)
*/
allItems.each(function (index) {
...
});
};
$(window).on("load", function() {
/* Resize all the grid items on the load and resize events */
$(window).bind("load resize", function(e) {
resizeAllMasonryItems( ".brick-inner" );
});
resizeAllMasonryItems(".brick-inner" );
});
});

当您将其称为resizeAllMasonryItems时,您的函数名称resizeAllMansonryItems。 中间有一个s:resizeAllMansonryItems。

这是一个错别字,请查看您的函数声明名称是否从您的函数调用名称更改

最新更新