2013-04-18 29 views
0

出在我的SharePoint網站的所有網頁的相互矛盾的,我有一個要求使用頁...保留jQuery的文件版本從海誓山盟

jQuery的工具& videolightbox &的jQuery 1.3.2(全一包!)。

網站的其餘部分使用jQuery 1.8.3

但這同一頁上,標題,菜單和頁腳需要以正確運行使用jQuery 1.8.3的。這是我發生衝突的地方,也是我頭痛的地方。

在這個單一/衝突的頁面上,我該如何防止jQuery 1.3.2與我的其他jQuery 1.8.3方法和函數相沖突,這些方法和函數是在custom-scripts-for-the-the-the-site .js文件?

下面是我的代碼是如何在我的主模板的底部設置一個演示...

<!--THESE 2 FILES WORK GREAT FOR THE ENTIRE SITE--> 
    <script src=".../jquery-1.8.3.min.js" type="text/javascript"></script> 
    <script type="text/javascript" src=".../custom-scripts-for-the-whole-site.js"></script> 

    <script type="text/javascript"> 
    /*THIS SECTION LOADS JQUERY 1.3.2 IN ORDER FOR JQUERY TOOLS AND VIDEOLIGHTBOX TO WORK 
    JQUERY TOOLS BUNDLES 1.3.2 WITHIN IT'S OWN FILE! - FYI 
    I SET UP A CONDITIONAL STATEMENT TO LOAD THIS CODE ONLY ON THIS SPECIFIC PAGE. 
    */ 
    var mLof = document.getElementById("donate-landing-page"); 
    if(mLof !=null) { 
    document.write(unescape("%3Cscript src='/jquery.tools.min.live.js' type='text/javascript'%3E%3C/script%3E")); 
    document.write(unescape("%3Cscript src='/swfobject.js' type='text/javascript'%3E%3C/script%3E")); 
    document.write(unescape("%3Cscript src='/videolightbox.js' type='text/javascript'%3E%3C/script%3E")); 
    document.write(unescape("%3Cscript src='/jquery.easing.1.3.js' type='text/javascript'%3E%3C/script%3E")); 
    } 
    //*/ 
    </script> 

感謝您的諮詢!

+0

的可能重複[我可以使用jQuery的多個版本在同一頁面上?(http://stackoverflow.com/questions/1566595/can-i-使用多個版本的jquery-on-the-the-page) – Blazemonger

回答

0

你需要$.noConflictAPI

<script type="text/javascript"> 
/*THIS SECTION LOADS JQUERY 1.3.2 IN ORDER FOR JQUERY TOOLS AND VIDEOLIGHTBOX TO WORK 
JQUERY TOOLS BUNDLES 1.3.2 WITHIN IT'S OWN FILE! - FYI 
*/ 
var mLof = document.getElementById("donate-landing-page"); 
if(mLof !=null) { 
document.write(unescape("%3Cscript src='/jquery.tools.min.live.js' type='text/javascript'%3E%3C/script%3E")); 
document.write(unescape("%3Cscript src='/swfobject.js' type='text/javascript'%3E%3C/script%3E")); 
document.write(unescape("%3Cscript src='/videolightbox.js' type='text/javascript'%3E%3C/script%3E")); 
document.write(unescape("%3Cscript src='/jquery.easing.1.3.js' type='text/javascript'%3E%3C/script%3E")); 
jq132 = $.noConflict(true); 
} 
//*/ 
</script> 
+0

好吧,我會試試看... – blackhawk