Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery fadeIn() on display none

Tags:

html

jquery

I have a div where I did a $('#div').css('display', 'none');

Now, to bring this item back, I want to fade it in. However, it seems like $('#div').fadeIn() is not doing it, but I don't want to set display back to block, as if I do it just re-appears instantly instead of fading.. any ideas?

like image 463
automaton Avatar asked Jun 22 '11 20:06

automaton


Video Answer


2 Answers

4 years too late but im hoping this will at least help someone out.

You need to first change the CSS class using jquery to visibility:hidden and then apply the fade in function. You can chain these within the same function or run them seperately. Either way you should see the element just fade back into existance as expected.

like image 78
Ash Avatar answered Oct 07 '22 08:10

Ash


Try

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

instead of

display:none;
like image 28
Jose Faeti Avatar answered Oct 07 '22 09:10

Jose Faeti