Author: Kris Hadlock
Publisher: Peachpit Press
Reviewer: Ian Elliot
jQuery Mobile is an important open source library for creating mobile web sites and apps. Can this slim book provide everything you need to know?
Writing a mobile HTML app should be easy, but if you want it to look more like a native app then you need some help. jQuery Mobile is a framework that you can use to build a UI that operates in more or less the same way on a range of supported devices. This book starts off with a brief introduction to the general ideas and which devices are supported - iOS, Android, Windows Phone, BlackBerry and HP WebOS. To see what the current state of support actually is you are better off checking out the jQuery website.
Part I of the book is called The Foundation of jQuery Mobile and it starts off with a brief look at jQuery. This is very short and not really up to the job of teaching a complete beginner. However, you don't need to know very much jQuery to use jQuery Mobile - arguably nothing at all. Even though the introduction is short, for reasons that are not clear it delves into advanced topics such as queues and their use in animation. This explanation is the first of many that are less than helpful. The book has a repeating pattern of seeming to explain things reasonably well and then suddenly talking about something out of sequence - which tends to lose the reader. The chapter closes with a look at doing Ajax raw in the browser and then with the help of jQuery.
Next we have a chapter on HTML5. After a little discussion of how easy HTML5 is we look at the viewport meta tag and how to use it and then at custom data attributes - something that jQuery Mobile uses to extend basic HTML5. As with the introduction to jQuery, this isn't going to get you very far if you don't already know HTML.
Finally in Chapter 3: Getting Started With jQuery Mobile the book starts to show its true nature. There are parts of it that seem very clear and easy to read, but every so often you are thrown something which hasn't been explained or introduced - and the result is that you are simply lost. I know how jQuery Mobile works and I was lost at more than one place and had to re-read many passages to see if I'd missed something. For example, in explaining the two ways that pages can be packaged as a multipage application, the HTML for page one is presented but not that for page two. This might be forgivable, but there is so much repetition that it seems perverse to leave this out.
The next chapter focuses in on creating multipage sites and the attempt to explain the range of link types that jQuery Mobile uses is very confusing. It explains that if you put all you pages in a single page - the book is never very clear on the distinction between the dynamic jQuery Mobile pages and the HTML pages, i.e. the files that store them - then you use a link something like #pageone. The book then says "It's similar to creating a page anchor." In fact it is exactly a page anchor because jQuery Mobile converts the page id into an anchor, which you can then reference. Trying to make it sound like this is something new is misleading. When we reach the summaries of the different types of link then it is made even harder to follow by not being clear what is intended by their use.
The entire book describes what is happening without any reference to how it is happening, and in this case how things happen is very instructive and helps you understand. A tiny bit of understanding makes it all seem so much easy to use jQuery Mobile.
From here the book moves though the features of jQuery Mobile in a fairly logical order - Dialogs, buttons, toolbars, layout, lists, forms, and finally themeing. As in earlier chapters we have sections that are clear spoiled by the sudden introduction of the unexplained. The examples might be useful if you really need lots of examples of the obvious but there is a lot of repetition in the code.
Part IV, don't ask me what happened to Part III which is completely missing , is called the The Mobile APIs. I'm not at all sure why this deserves a section all to itelf, but it covers things like working with touch events and generally using jQuery Mobile in intersting ways.
Part V is on jQuery Mobile CMS which is about using it with WordPress and Drupal. If you don't know something about these two content management systems then you probably won't get much from the chapters.
Part VI Beyond jQuery Mobile is a side tour into detecting the type of mobile device you are serving a page to, using PHP, and how to test you web site using a simulator.
The biggest problem with this book is that fact that it is almost guaranteed to lose the reader every four or five pages. It keeps on adding ideas that are new without any warning.
Not for the beginner and certainly not for the expert. Give this one a miss and read the documentation instead.