通過cdn引用的js


jquery

Production version - 用於實際的網站中,已被精簡和壓縮。

Development version - 用於測試和開發(未壓縮,是可讀的代碼)

 

引用的兩種方式:

1 下載代碼文件至本地項目中,引入。

2 通過 CDN(內容分發網絡) 引用它

 

使用CDN引用的一個好處:許多用戶在訪問其他站點時,已經從百度、又拍雲、新浪、谷歌或微軟加載過 jQuery。所有結果是,當他們訪問您的站點時,會從緩存中加載 jQuery,這樣可以減少加載時間。同時,大多數 CDN 都可以確保當用戶向其請求文件時,會從離用戶最近的服務器上返回響應,這樣也可以提高加載速度。

菜鳥教程CDN:<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>

百度CDN:<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>

又拍雲:<script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-2.0.2.min.js"></script>

新浪:<script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>

Google:<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> (站點用戶是國外的才使用google的,國內使用google不穩定)

Microsoft:<script src="http://ajax.htmlnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script>

bootstrap:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">  
<script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM