X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

jQuery Mobile Install


Adding jQuery Mobile to Your Web Pages

There are two ways to add jQuery Mobile to your web site. You can:

  • Link to a jQuery Mobile library stored at a CDN (recommended)
  • Link to a jQuery Mobile library stored at your computer

Link to jQuery Mobile From a CDN

Note A CDN (Content Delivery Network) is used to distribute often-used files across the web.
This makes download speed much faster for the user.

As with jQuery core, there is nothing to install on your computer; you just include the following stylesheet (.css) and JavaScript libraries (.js) directly into your HTML page, to get jQuery Mobile to work:

jQuery Mobile CDN:

<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>

Try it yourself »

Note The meta viewport tag in <head> specifies how the browser should control the page zoom level and dimensions. By default, mobile devices assume that pages are about 900 pixels wide. This is to make it work well with existing desktop sites, but the screens may look zoomed out and too wide. By setting the viewport attributes, the browser is set to the screen width of the device - and the content remains at the correct scale.


Link to jQuery Mobile Stored at Your Computer

If you want to host the jQuery Mobile library yourself, you must first download it from jQuerymobile.com.

Then add the following code to your page:

<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile-1.4.2.css">
<script src="jquery.js"></script>
<script src="jquery.mobile-1.4.2.js"></script>
</head>

Tip: Place the downloaded files in the same directory as the pages where you wish to use it.

Note Do you wonder why we do not have type="text/javascript" inside the <script> tag?

This is not required in HTML5. JavaScript is the default scripting language in HTML5 and in all modern browsers!



Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook