Book Image

jQuery Mobile Cookbook

By : Chetan Jain
Book Image

jQuery Mobile Cookbook

By: Chetan Jain

Overview of this book

jQuery Mobile is an award winning, HTML5/CSS3 based open source cross-platform UI framework. It offers a very cool and highly customizable UX. It is built on the popular jQuery library and uses declarative coding making it easy to use and learn. It is the market leader today considering the numerous browsers and platforms that it supports."jQuery Mobile Cookbook" presents over a hundred recipes written in a simple and easy manner. You can quickly learn and start writing code immediately. Advanced topics such as using scripts to manipulate, customize, and extend the framework are also covered. These tips address your common everyday problems. The book is very handy for both beginner and experienced jQuery Mobile developers.You start by developing simple apps using various controls and learn to customize them. Later you explore using advanced aspects like configurations, events, and methods.Develop single and multi-page applications. Use caching to boost performance. Use custom transitions, icon sprites, styles, and themes. Learn advanced features like configurations, events, and methods. Explore future trends by using HTML5 new features and semantics with jQuery Mobile."jQuery Mobile Cookbook" is an easy read and is packed with practical tips and screenshots.
Table of Contents (19 chapters)
jQuery Mobile Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Using the DOM cache to improve performance


During page navigation in a single-page template application, each new page is fetched and stored in the DOM. The page remains in the DOM and is removed once you navigate away from the page. Only the main or the first page of the app always remains in the DOM. As seen in the previous recipe, prefetching commonly-used pages could help in improving performance to some extent. But when you visit a prefetched page and navigate away from it, the page gets removed from the cache. So the problem of multiple fetching of frequently visited pages is not fully solved.

With DOM caching, specific pages are marked to be cached in the DOM. These pages, once loaded, remain in the DOM all through the life cycle of the app. You can use the DOM cache in two ways. The first is by adding the data-dom-cache attribute to the page container of the page that is to be cached. The second way is by using JavaScript. This recipe shows you how to improve the performance of your...