Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  107] [ 7]  / answers: 1 / hits: 39092  / 10 Years ago, mon, july 28, 2014, 12:00:00

I'm trying to make a section of my site fadeIn after 5 seconds using the following:



$('#topScroll').delay(5000).fadeIn(400);


I can't seem to get it to work. Does this need to be hooked to an event? I see that doing the same with fadeOut works just fine with no event.



<div id=topScroll>
<a class=scroll>Scroll<br /><img src=images/scroll.png alt=scroll /></a>
</div>


I thought perhaps the div needed to be display:none first before it can fade in, but this doesn't seem to make a difference.


More From » jquery

 Answers
6

Try this: $('#topScroll').hide().delay(5000).fadeIn(400);



Your div is already visible, so you might as well hide it again for fadeIn() to perform.



fadeOut() works because topscroll is already visible. reference: http://api.jquery.com/fadeout/


[#70012] Friday, July 25, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eliasf

Total Points: 703
Total Questions: 97
Total Answers: 129

Location: Chad
Member since Tue, Apr 27, 2021
3 Years ago
;