2013-01-22 187 views
0

我在一個頁面中使用了兩個jQuery庫(Tab & Gallery),現在兩個版本的jQuery庫都不能使用了。我必須刪除一個庫才能工作。jQuery庫衝突

二手版本

1.7.1 jQuery.mini.js for Gallery

1.6.2 jQuery.mini.js - for tab

這個

--http://ajax.googleapis.com/ajax/libs/jquery -ui-1.8.16.custom.min.js

我這裏怎麼用這個編碼

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> 
<script>window.jQuery || document.write('<script src="../js/libs/jquery-1.6.2.min.js"><\/script>')</script> 
<script src="../js/libs/jquery-ui-1.8.16.custom.min.js"></script> 
<script // type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 

請告訴這

回答

1

只有使用最新的源泉!並把它放在jQuery UI之前。最好從同一個來源獲取文件,最好是CDN,比如谷歌的。

這些是最新版本,您使用的是過時版本。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script> 
+0

還有畫廊不會低於我的工作 已經給出了圖庫java腳本的鏈接。請檢查 --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.tmpl.min.js --http://tympanus.net/codrops/wp-content/plugins/oiopub-direct /js.php?type=banner&align=center&zone=1 --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.easing.1.3.js --http://tympanus.net/Tutorials /ResponsiveImageGallery/js/jquery.elastislide.js --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/gallery.js --http://tympanus.net/codrops/adpacks/csscustom.js –

0

的解決方案,不要引用jQuery庫的兩倍 - 它會嘗試重寫功能,打破你的腳本。你只需要一次引用它:

src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script src="../js/libs/jquery-ui-1.8.16.custom.min.js"></script> 
+0

當我只使用jQuery的lib部分。它畫廊不會工作。 這裏是庫使用jQuery的 --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.tmpl.min.js --http://tympanus.net/codrops/wp-content/ ?插件/ oiopub直接/ js.php類型=橫幅&對齊=中心區&= 1 --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.easing.1.3.js --http:// tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.elastislide.js --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/gallery.js --http://tympanus.net/codrops/ adpacks/csscustom.js –

0

只是不包括jQuery的兩倍......

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script src="../js/libs/jquery-ui-1.8.16.custom.min.js"></script> 
+0

仍然畫廊不會工作 下面我已經給畫廊java腳本的鏈接。請 --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.tmpl.min.js --http://tympanus.net/codrops/wp-content/plugins/oiopub-direct /js.php?type=banner&align=center&zone=1 --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/jquery.easing.1.3.js --http://tympanus.net/Tutorials /ResponsiveImageGallery/js/jquery.elastislide。JS --http://tympanus.net/Tutorials/ResponsiveImageGallery/js/gallery.js --http://tympanus.net/codrops/adpacks/csscustom.js –

0

您可能會污染名稱空間。更改$ jQuery,使用noconflict()或使用自我調用匿名函數