开发者

Hide 'div' after specific amount of time

开发者 https://www.devze.com 2023-02-05 04:52 出处:网络
I have a div, which is generally used for showing some status messsage like \"you have selected some xyz thing\"

I have a div, which is generally used for showing some status messsage like "you have selected some xyz thing"

Now, I need to hide it at interval of specific amount of time (say开发者_如何学运维, 60 secs) after page loads.

Code:

 <div id="msg">You have selected 'Time and Money' magazine</div>

How can I perform the above mentioned thing?

Thanks


$(document).ready(function () {
  setTimeout(function () {
      $('#msg').hide();
  }, 60000);
});


To hide msg after 60 seconds, do this

$("#msg").fadeOut(60000);


This should do what you need: jQuery Timers

$(function(){
  $(document).oneTime(60000, function(){
    $('#msg').hide();
  });
});


you can use setTimeout this -

$('document').ready(function(){
  window.setTimeout('test()',time in milliseconds);
});

function test(){

  $('#divid').hide();

}


You can use jQuery's 1.4 delay function

0

精彩评论

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