开发者

Jquery show div for 10 seconds

  $(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!


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);


 $('#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:

  • delay
  • fadeOut
  • queue


setTimeout(function(){ $("#loading").fadeOut(); }, 10000);


Use Jquery delay

   $("#loading").show().delay( 10000 ).hide();


$('#loading').animate({ opacity: 1 }, 10000);


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜