Reputation: 1762
I am trying to display a loading GIF and display it until a page has completely loaded.
Here is my jQuery/Javascript code:
$(document).ready(function(){
$('#myTab a').on('load', function (e) {
e.preventDefault();
$(this).tab('show');
},onLoadSomeFunction());
}
onLoadSomeFunction()
leads my page to get some values and load them into it.
How can I show my loading gif until all the page loading process ends ?
Upvotes: 0
Views: 912
Reputation: 371
//Try using this following code
<img src="loader.gif" class="gif_image"/>
//Jquery
$(document).ready(function(){
$('#myTab a').on('load', function (e) {
e.preventDefault();
$(this).tab('show');
},onLoadSomeFunction());
}
$(window).load(function()
{
$('.gif_image').hide();
});
Upvotes: 1
Reputation: 72289
please try this:-
$(document).ready(function(){
$('#myTab a').on('load', function (e) {
e.preventDefault();
$(this).tab('show'); or $('#load_img/message').show();// div having loading image/message and initially property hidden
},onLoadSomeFunction()); or success : function(html){
//your functionality after success
$('#load_img/message').hide(); // hide the loading image/message
}
}
Upvotes: 1