Wordpress超过2个版本jquery

时间:2014-02-24 08:55:02

标签: jquery wordpress

我正在使用wordpress网站,问题是我有超过2个版本的jquery。

问题是导航栏无法在单个页面上运行,即:

http://staging.skyberate.nl/shared-hosting/magento-hosting/referenties/

如果你看到,导航栏href仍然有效,但下拉列表不会。但在其他页面上它可以正常工作。

我正在读这个:

http://blog.nemikor.com/2009/10/03/using-multiple-versions-of-jquery/

但我不知道如何在wordpress上使用它,因为一切都是动态的。即使是单页也是动态的......

2 个答案:

答案 0 :(得分:1)

创建一个不同的别名而不是jQuery ,以便在脚本的其余部分中使用。

var j = jQuery.noConflict();

使用jQuery执行某些操作 (在脚本发生冲突的情况下使用alise j代替$)

j( "div p" ).hide();

使用其他库的$()

执行某些操作

$(“content”)。style.display =“none”;

=============================================== ================================== 其他例子

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="jquery.superautocomplete.js"></script> <!-- this uses 1.9.1 -->
</head>
<body>

<div id="log">
  <h3>Before $.noConflict(true)</h3>
</div>
<script src="http://code.jquery.com/jquery-1.3.2.js"></script>
<script src="jquery.fancybox.js"></script> <!-- this uses 1.3.2 -->

<script>
/*
Restore globally scoped jQuery variables to the first version loaded
(the newer version)
*/
jq132 = jQuery.noConflict(true);
jq132("[rel=fancybox]").fancybox(); // using 1.3.2
$("#autocomplete").superautocomplete(); // using 1.9.1
</script>

</body>
</html>

Referrence from here

答案 1 :(得分:0)

已经修好了!

问题在于网站的标题。在网络服务器上链接了一个jQuery库,我自己的jQuery链接到谷歌的jQuery库。 所以我从服务器库中复制了自己的路径并将其粘贴到谷歌库中,而不是链接到谷歌库,这很好用!