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

Working with page loaders


Page loaders are a very nice piece of jQuery Mobile that allow you to let the users know that something is going on with your app, and that it is just not sitting idle or has not frozen.

Adding a page loader to your application is extremely easy. For our example, we are going to add one to our Events popup to let the user know we are loading events. For now, we will use the default icon, but in a later chapter, we will create our own so that it is customized.

Add the following code to the <head> section of your page:

    <script>
        $(document).on("click", ".show-page-loading-msg", function() {
            var $this = $(this),
            theme = $this.jqmData("theme") || $.mobile.loader.prototype.options.theme,
            msgText = "Loading Events",
                textVisible = $this.jqmData("textvisible") || $.mobile.loader.prototype.options.textVisible,
                textonly = !!$this.jqmData("textonly"),
                html = $this.jqmData...