1
2$('body').append('<div style="" id="loadingDiv"><div class="loader">Loading...</div></div>');
3$(window).on('load', function(){
4 setTimeout(removeLoader, 2000); //wait for page load PLUS two seconds.
5});
6function removeLoader(){
7 $( "#loadingDiv" ).fadeOut(500, function() {
8 // fadeOut complete. Remove the loading div
9 $( "#loadingDiv" ).remove(); //makes page more lightweight
10 });
11}
1$('body').append('<div style="" id="loadingDiv"><div class="loader">Loading...</div></div>');
2$(window).on('load', function(){
3 setTimeout(removeLoader, 2000); //wait for page load PLUS two seconds.
4});
5function removeLoader(){
6 $( "#loadingDiv" ).fadeOut(500, function() {
7 // fadeOut complete. Remove the loading div
8 $( "#loadingDiv" ).remove(); //makes page more lightweight
9 });
10}