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

JqueryVisibilityFadein

Jquery Problem Overview


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');

Jquery Solutions


Solution 1 - Jquery

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.

Solution 2 - Jquery

try using opacity and animate():

$('.littleme').css('opacity',0).animate({opacity:1}, 1000);

Solution 3 - Jquery

<span style="opacity:0;">I'm Hidden</span>

To Show : $('span').fadeTo(1000,1)

To Hide  : $('span').fadeTo(1000,0)

The space is preserved in the DOM layout

http://jsfiddle.net/VZwq6/

Solution 4 - Jquery

Cant you use fadeTo(duration, value) instead? Surely this way you can fade to 0 and 1, that way you are not affecting the document flow...

Solution 5 - Jquery

Try matching for the hidden element?

$(".littleme:hidden").fadeIn();

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkalpaitchView Question on Stackoverflow
Solution 1 - JqueryNick CraverView Answer on Stackoverflow
Solution 2 - JqueryDavid HellsingView Answer on Stackoverflow
Solution 3 - JqueryuserView Answer on Stackoverflow
Solution 4 - JqueryNeilView Answer on Stackoverflow
Solution 5 - JqueryiivelView Answer on Stackoverflow