Book Image

Mastering jQuery UI

By : Vijay Joshi
Book Image

Mastering jQuery UI

By: Vijay Joshi

Overview of this book

Table of Contents (19 chapters)
Mastering jQuery UI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Making the tour functional


Now that the layout of our page is complete, let's discuss in brief how we are going to implement the tour functionality. We have already created a tour.js file that we will use for writing all the JavaScript code.

We will initialize the accordion for which we have already written the markup, and we will also initialize the tooltip that will appear on hovering over the Contact Us link.

After that, we will define a jQuery UI dialog component with some basic settings and buttons for navigating the tour. Next, we will define a JavaScript array that will contain all the steps of the tour. Finally, we will create a tour object, and we will write the functions that will initialize the tour, display a tour step, and handle the Previous, Next, and End Tour buttons.

Let's write the code for the aforementioned steps and discuss them in detail.

Initializing accordion and tooltips

The best practice when writing JavaScript is to start by writing a jQuery $(document).ready() handler...