Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Forked from MorningZ/jQueryMobileBlock.js
Created July 2, 2012 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olimortimer/3036332 to your computer and use it in GitHub Desktop.
Save olimortimer/3036332 to your computer and use it in GitHub Desktop.
JS: Block page whilst showing jQuery loading message
/*
The jQuery Mobile "loading" message allows users to click on UI items around it
Using Mike Alsup's BlockUI, we can stop this
http://jquery.malsup.com/block/#download
Thanks to MorningZ
https://gist.github.com/MorningZ
*/
// Add this right before the closing <body> tag
(function () {
var originalHideMethod = $.mobile.hidePageLoadingMsg;
$.mobile.hidePageLoadingMsg = function () {
$("body").unblock();
originalHideMethod.apply(this, arguments);
};
var originalShowMethod = $.mobile.showPageLoadingMsg;
$.mobile.showPageLoadingMsg = function () {
$("body").block({ "message": null });
originalShowMethod.apply(this, arguments);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment