Gary
Gary

Reputation: 747

jQuery Mobile Wait until next page is ready before loading

I've been experimenting with jQuery Mobile. I am trying to implement the following

I would like to display the jquery mobile loading popup until the page is ready and then continue.

In the jQueryMobile Docs and Demos under 'list views' and 'list performance tests' this performs as how i would like mine to.

I've tried binding to the 'pagebeforeshow' event but to no avail.

Any help would be greatly appreciated.

Upvotes: 3

Views: 4654

Answers (3)

darshan sp
darshan sp

Reputation: 1

I also encountered same issue while loading pages. I used below code to eliminate

$(document).on("pagebeforeshow","#page",function(){ 
$("#header").empty();
$("#content").empty();
$("#footer").empty();
});

$(document).on("pageshow","#page",function()
{
$("#header").append("<h2 align='center'>"+'Header'+"</h2>");
$("#content").append("<h2 align='center'>"+'Content'+"</h2>");
$("#footer").append("<h2 align='center'>"+'Footer'+"</h2>");
});

Upvotes: 0

memical
memical

Reputation: 2503

try to put a click handler on the GUI item that you mentioned - the navbar.

in that function make the ajax call, and in the success function of the ajax call once you have setup your item show the next page.

To show the load spinning wheel use:

$.mobile.showPageLoadingMsg();

You move to the next page using:

$.mobile.changePage

Upvotes: 0

Vijay Parmar
Vijay Parmar

Reputation: 809

use this functions to hide and show loader and your own in java script

 //show loader
var showLoader = function () {   
        $('.ui-loader').css('display', 'block');
   }

 //hide loader
var hideLoader = function () {
            $('.ui-loader').css('display', 'none');
   }

Upvotes: 3

Related Questions