Reputation: 65143
Is there a way to hide a div after 1 second?
EDIT:
setTimeout(function(){
$j('.flotymessage').fadeOut(300);
},1000);
doesn't work =\ .floatymessage is a div
Upvotes: 0
Views: 435
Reputation: 46497
The jQuery delay() function is the way to go. The parameter to delay()
is in milliseconds so you need 1000 ms to get 1s.
$('div.flotymessage').delay(1000).hide("slow"); // hide it slowly
$('div.flotymessage').delay(1000).hide(1); // hide it after 1 ms (pretty much instantly)
An alternative to hide()
ing your <div>
is to assign it a new class that would have the CSS ready for the hiding. Let me know if you need me to elaborate on that.
Hope that helps.
Upvotes: 2
Reputation: 1754
if the above solution doesnt work for you (cant tell why, it should work) you can always try .delay so
setTimeout(function(){
$j('.flotymessage').fadeOut(300);
},1000);
would become
$j('.flotymessage').delay(1000).fadeOut(300);
€: im sorry i was too slow^^
Upvotes: 1
Reputation: 44939
Use setTimeout to hide after one second (1000 milliseconds).
setTimeout(function(){$('div#divID').hide();},1000);
Upvotes: 4