2014-02-24 35 views
0

我正在一个WordPress的网站,问题是,我有超过2个版本的jQuery。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的,因为一切都是动态的。即使一个页面是动态的...

+0

任何使用超过jquery 2versions的原因 – LarsEngeln

+0

我不知道,我没有制作整个网站。导航栏是3.8我认为和我在一个单页上做了1.8像。我不知道为什么,我真的很新jquery – thommylue

+0

删除第二个jquery include ..哪个文件处理您的导航的js? – flauntster

回答

0

它是固定的!

问题是在网站的标题。有一个链接到它自己的web服务器上的jQuery库,我自己的jQuery链接到一个来自谷歌的jQuery库。 因此,我从服务器库自己复制了路径,并将其粘贴到谷歌库中,而且工作正常!

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