我正在尝试在窗口加载时加载一些jquery但是我收到错误' jQuery未定义'。
这是我的jquery。
jquery(function($) { //jQuery passed in as first param, so you can use $ inside
jquery(window).load(function ($) {
$('#newsPost').masonry({
columnWidth: '.col-lg-6',
itemSelector: '.item'
});
})
});
我已经将文档准备好了,但窗口加载未定义。
以下是显示最终工作版本的更新:
jQuery(function($) {
$(window).load(function () {
$('#newsPost').masonry({
columnWidth: '.col-lg-6',
itemSelector: '.item'
});
})
});
答案 0 :(得分:0)
将jquery
替换为jQuery
或$
。
或者
您确定已加载jquery脚本文件吗?
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>