How can I have a jqueryui dialog display "Loading" at the beginning of document.ready (or sooner) and then have it disappear at the end of document.ready.
3 Answers
Try this it will work in all the browsers even if they are slow in javascript execution like IE 6/7
$(document).ready(function(){
$("LoadingContainer").dialog('open');
setTimeout(function(){
//Put all the stuff here which you want to execute on load
//Finally close the loading dialog
$("LoadingContainer").dialog('close');
}, 400);
});
Comments
I would have an element that displays the message, and simply hide it when the document.ready is ready. For example:
$(document).ready(function() {
// All other loading items
$("#loadingMessage").hide();
});
Make sure you put the hide() function as the last, that way everything else loads first.
1 Comment
Eric Di Bari
Be sure to style #loadingMessage appropriately and by default set the display to something visible.