jQuery Mobile installation
Add jQuery Mobile to your webpage
You can add jQuery Mobile to your webpage in the following ways:
Load jQuery Mobile from CDN (recommended)
Download the jQuery Mobile library from jQuerymobile.com
From Loading jQuery Mobile in CDN
The full name of CDN is Content Delivery Network, which is the content distribution network. The basic idea is to avoid bottlenecks and links on the Internet that may affect data transmission speed and stability as much as possible, so that content transmission can be faster and more stable. . |
To use jQuery core, you don’t need to install anything on your computer; you just need to load the following cascading styles (.css) and JavaScript libraries ( .js) to use jQuery Mobile:
Instance
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <div data-role="page" id="pageone"> <div data-role="header"> <h1>欢迎来到我的主页</h1> </div> <div data-role="content"> <p>欢迎!</p> </div> <div data-role="footer"> <h1>底部文本</h1> </div> </div> </body> </html>
Run Instance»
Click the "Run Instance" button View online examples
Domestic users recommend using Baidu CDN:
Instance
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <div data-role="page" id="pageone"> <div data-role="header"> <h1>欢迎来到我的主页</h1> </div> <div data-role="content"> <p>欢迎!</p> </div> <div data-role="footer"> <h1>底部文本</h1> </div> </div> </body> </html>
Running instance»
Click the "Run Instance" button to view the online instance
The library referenced in this tutorial is the Baidu CDN resource library.
Download jQuery Mobile
If you want to put jQuery Mobile on your host, you can download the file from jQuerymobile.com.
<head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="jquery.mobile-1.4.5.css"> <script src="jquery.js"></script> <script src="jquery.mobile-1.4.5.js"></script> </head>
Tips: Place the downloaded file in the same directory as the web page.
##Have you ever wondered why type="text/javascript is not inserted in the <script> tag? "? This attribute is no longer needed in HTML5. JavaScript is the default scripting language for HTML5 in all modern browsers! |