jQuery Mobile 安裝
向您的網(wǎng)頁添加 jQuery Mobile
有多個辦法可供您在網(wǎng)站上開始使用 jQuery Mobile。您可以:
- 從 CDN 引用 jQuery Mobile(推薦)
- 從 jQuerymobile.com 下載 jQuery Mobile 庫
從 CDN 引用 jQuery Mobile
提示:CDN (Content Delivery Network) 用于通過 web 來分發(fā)常用的文件,以此加快用戶的下載速度。
與 jQuery 類似,無需在您的計算機上安裝任何程序;您只需直接在 HTML 頁面中引用以下樣式表和 JavaScript 庫,這樣 jQuery Mobile 就可以工作了:
jQuery Mobile CDN:
<head> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"> <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head>
下載 jQuery Mobile
如果您希望在服務(wù)器上存放 jQuery Mobile,您可以從 jQuerymobile.com 下載文件。
<head> <link rel=stylesheet href=jquery.mobile-1.3.2.css> <script src=jquery.js></script> <script src=jquery.mobile-1.3.2.js></script> </head>
提示:請將下載的文件放到您希望使用的文件夾中。
提示:您是不是奇怪為什么 <script> 標簽中沒有 type="text/javascript" 屬性?
在 HTML5 中該屬性不是必需的。JavaScript 是 HTML5 以及所有現(xiàn)代瀏覽器中的默認腳本語言!