【问题标题】:WordPress jQuery error: "Uncaught TypeError: Cannot set property 'value' of null"WordPress jQuery 错误:“未捕获的类型错误:无法设置属性‘值’为空”
【发布时间】:2011-02-01 22:54:14
【问题描述】:

我已经搜索了一系列与此相关的问题,但并不完全准确,所以这里是:

我一直在开发一个网站,该网站(不幸的是)在 WordPress 中使用了三个不同的 jQuery 插件(索引上的图像轮播,Portfolio 页面上的图片库插件“Galleria”,联系我们页面上的自定义联系表格 7)。

在一些帮助下,我已经能够消除它给我带来的大部分错误,但我现在只剩下最后一个了:

未捕获的类型错误:无法将属性“值”设置为 null

我已经拆分,以便在 header.php 中调用以下内容:

    <link href="http://www.cypresshilldevelopment.com/wp-content/themes/CHD2/galleria.css" rel="stylesheet" type="text/css" media="screen, print"/> 

然后在footer.php中调用其余部分:

<script type="text/javascript" src="http://www.cypresshilldevelopment.com/wp-content/themes/CHD2/galleria_wp/js/jquery.galleria.js"></script> 
<script type="text/javascript"> 
    $ = jQuery;
    $(function(){ $('ul.gallery').galleria({tempClass: 'active', thumbnail_caption: ''}); })
</script>

    <!-- script for jQuery image carousel -->
    <script type="text/javascript" src="/wp-content/themes/CHD2/js/jquery.cycle.all.min.js"></script> 
    <script type="text/javascript" src="/wp-content/themes/CHD2/js/jquery.easing.compatibility.js"></script> 
    <script type="text/javascript" src="/wp-content/themes/CHD2/js/jquery.easing.1.3.js"></script>

    <script type="text/javascript" src="/wp-content/themes/CHD2/js/app.js"></script>
    <!--[if lte IE 6]>
        <script type="text/javascript" src="supersleight-min.js"></script>
    <![endif]-->

我在这里做错了什么?我是否错误地拆分了代码?错误指向 WordPress 为定义 wphc_value 值的页面生成的代码中的一行,但在我的一生中,我无法在任何 php 或 js 文件中找到对“wphc”的任何引用用过。

【问题讨论】:

  • 这是 PHP 错误还是 JavaScript 错误?看起来像是 JavaScript 错误,但 wphc_value 似乎与 Wordpress Hashcash 插件有关。
  • 我认为这是 JavaScript 错误,但可能是错误的。我绝对没有使用 Hashcash 插件,尽管我确实在 Google 搜索中看到了它。另一个让我彻底困惑的原因。

标签: jquery wordpress galleria


【解决方案1】:

不知道是不是这个错误信息的原因,但是你需要在初始化之前为Galleria加载一个主题(loadTheme)。

http://galleria.aino.se/docs/1.2/getting_started/beginners_guide/

另外,不知道你为什么有$ = jQuery;,你可能不需要它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-06
    • 1970-01-01
    相关资源
    最近更新 更多