I'm using jQuery Mobil开发者_如何学编程e and have turned off the default AJAX handling of forms and links, and I'm using
$.mobile.showPageLoadingMsg()
to display the page loading message when I submit a form that transitions me to a different page. This works fine except for the fact that if I use the hardware back button on the device, or the browser's back button to go back to the form, the page loading message is still running. I've tried calling
$.mobile.hidePageLoadingMsg()
on document ready but this didn't seem to fire when I used the back button to go back.
This could be solved by listening to window unload and hiding the message there:
$(window).unload(function(){
$.mobile.hidePageLoadingMsg();
});
It seems like somewhat of a hack though.
Try: $.mobile.pageLoading( true );
Docs: http://jquerymobile.com/demos/1.0a4.1/#docs/api/methods.html
Show or hide the page loading message, which is configurable via $.mobile.loadingMessage
.
Arguments:
Done (boolean, defaults to false, meaning loading has started). True will hide the loading message.
Examples:
//cue the page loader
$.mobile.pageLoading();
//hide the page loader
$.mobile.pageLoading( true );
精彩评论