未定义jQuery的WordPress的窗口加载 [英] jquery is not defined wordpress window load

查看:60
本文介绍了未定义jQuery的WordPress的窗口加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在窗口加载时加载一些jquery,但是我收到了未定义jQuery"的错误.

I am trying to load some jquery on window load however I recieve the error of 'jQuery is not defined'.

这是我的jquery.

Here is my 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'
    });      
})
});

我在准备好文档的情况下可以正常工作,但是未定义窗口负载.

I had it working fine with document ready however window load is coming up not defined.

以下是显示最终工作版本的更新:

Here is an update showing the final working version:

jQuery(function($) { 
$(window).load(function () {
$('#newsPost').masonry({
  columnWidth: '.col-lg-6',
  itemSelector: '.item'
});      
})
});

推荐答案

jquery替换为jQuery$.

确定要加载jquery脚本文件吗?

Are you sure you have loaded jquery script file ?

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>

这篇关于未定义jQuery的WordPress的窗口加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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