admin管理员组

文章数量:1302428

I want if a message(div class="message") there is (mean was display: block;) after 5000 milliseconds it is hide(display: none;). how is it?

Example: /

<div class="message">This is a message</div>

setTimeout(function(){ $('.message').fadeOut('slow'); }, 5000);

I want if a message(div class="message") there is (mean was display: block;) after 5000 milliseconds it is hide(display: none;). how is it?

Example: http://jsfiddle/SLRFt/1/

<div class="message">This is a message</div>

setTimeout(function(){ $('.message').fadeOut('slow'); }, 5000);
Share edited Oct 5, 2011 at 9:15 Jennifer Anthony asked Oct 5, 2011 at 8:56 Jennifer AnthonyJennifer Anthony 2,27710 gold badges38 silver badges56 bronze badges 6
  • 1 5000 seconds = about 1.5 hours. Did you mean 5000 microseconds? – IvanGL Commented Oct 5, 2011 at 8:58
  • please rephrase your question because it is very unclear what you are asking actually. – Sander Commented Oct 5, 2011 at 9:10
  • @IvanGL: 5000 microseconds = 0.005 seconds. – Dennis Commented Oct 5, 2011 at 9:12
  • oh yes, i mean is microseconds. – Jennifer Anthony Commented Oct 5, 2011 at 9:14
  • @Dennis: I know, but in original question there was 5000 seconds. – IvanGL Commented Oct 8, 2011 at 6:34
 |  Show 1 more ment

1 Answer 1

Reset to default 12
$('.message').delay(5000).fadeOut('slow');

http://jsfiddle/xavi3r/SLRFt/3/

本文标签: javascriptHide a message after 5000 milliseconds with jqueryStack Overflow