Reputation: 149
$(window).load(function(){
$("#loading").show(10); //it was hide but changed to show, not working
<div id="loading">
Loading content, please wait..
<img src="loading.gif" alt="loading.." />
</div>
how can I get this loading bar to show for 10 seconds?
any help is greatly appreciated!
Upvotes: 3
Views: 21757
Reputation: 2663
You can add this code...
$("#loading").show(10000,function(){
$("#loading").hide();
});
<div id="loading" style="display:none;">
Loading content, please wait..
<img src="loading.gif" alt="loading.." />
</div>
this will display the div only for 10 second.. after 10 second div will disappear..
Upvotes: 0
Reputation: 136239
$('#loading').delay(10000).fadeOut();
If you dont want to fade out you can also do
$('#loading').delay(10000).queue(function(){ $(this).hide();$(this).dequeue(); });
Docs:
Upvotes: 4
Reputation: 3726
Use Jquery delay
$("#loading").show().delay( 10000 ).hide();
Upvotes: 3
Reputation: 322612
If you meant that it's currently showing, and you want it to hide after 10 seconds, do this:
$("#loading").delay(10000).hide(0);
Or if you actually wanted an animation with the .hide()
, add a longer duration:
$("#loading").delay(10000).hide(400);
Upvotes: 11