jquery fade element does not show elements styled 'visibility: hidden'

kalpaitch picture kalpaitch · Mar 12, 2010 · Viewed 44.5k times · Source

I have a bunch of thumbnails which I am loading with a style of visibility: hidden; so that they all maintain their correct layouts. Once the page is fully loaded I have a jquery function that fades them in. This worked when their style was set to display: none; but obviously the layout screwed up then. Any suggestions?

Heres the fade line:

$('.littleme').fadeIn('slow');

Answer

Nick Craver picture Nick Craver · Mar 12, 2010

Add a few calls to the chain like this:

 $('.littleme').css('visibility','visible').hide().fadeIn('slow');

This will change it to display:none for 1 frame before fading in, occupying the area again.