Book Image

Mastering jQuery Mobile

Book Image

Mastering jQuery Mobile

Overview of this book

Table of Contents (17 chapters)
Mastering jQuery Mobile
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Navigating with swipe gestures


Smartphones have really rewired the way most users navigate or want to navigate a website. Within native applications, most of the time we can swipe left, right, up, or down to get to the information we want. Occasionally, we may slip up and try this on websites that we view on our phones, and more times than not, we are met with a failure and remain on the same page that we were on when we started swiping.

Luckily for you and your future visitors and users, jQuery Mobile supports swiping gestures for left and right. We can capitalize on that and use it for navigation between our pages. It would be more difficult to do if we had our pages in individual files, as we previously did but, since we combined them all into one multi-page document, we can iterate through each of the pages in the file via swiping.

To implement this, we need to create a JavaScript function at the bottom of our current index.html file, right before the ending body tag. It can technically...