In the preface, we talked about how jQuery Mobile is just a set of files. This wasn't said to minimize the amount of work done to create those files or to play down how powerful they are, but to emphasize that using jQuery Mobile means that you don't have to install any special tools or server. You can download the files and simply include them in your page. And if that's too much work, you have an even simpler solution. jQuery Mobile's files are hosted on a Content Delivery Network (CDN). This is a resource hosted by them and it is guaranteed (as much as anything like this can be) to be online and available. Multiple websites are already using these CDN hosted files. This means that when users hit your website, they may already have the resources in their cache. For this book, we will be making use of the CDN hosted files. Just for this first example, we'll download the ZIP file and extract the files we need.
I recommend doing this anyway for the times when you're on an airplane and wanting to whip up a quick mobile website.
To grab the files, visit http://jquerymobile.com/download. There are a few options here, but you want the ZIP file option. Go ahead and download the ZIP file and extract it (the ZIP file you downloaded earlier from GitHub has a copy already). The following screenshot demonstrates what you should see after extracting the content from the ZIP file:
An important note: at the time this book was written, jQuery Mobile was at version 1.4.5. Obviously, by the time you read this book, a later version may be released. The filenames you see listed in the previous screenshot are version-specific, so keep in mind that they may look a bit different for you.
The ZIP file contains
demos and both the minified and regular versions of the jQuery Mobile framework. Additional files are provided for theming and other purposes, but your main concern will be with
jquery.mobile-1.4.5.min.js. You will typically want to use the minified version in your production apps though. The
images folder contains various images used by jQuery Mobile's CSS file. Of course, you also need to include the jQuery library.
You can download this separately at http://www.jquery.com.