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

后端 未结 5 1193
情话喂你
情话喂你 2020-11-28 23:11

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 load

相关标签:
5条回答
  • 2020-11-28 23:32

    <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/

    0 讨论(0)
  • 2020-11-28 23:32

    Try matching for the hidden element?

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

    0 讨论(0)
  • 2020-11-28 23:34

    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...

    0 讨论(0)
  • 2020-11-28 23:49

    try using opacity and animate():

    $('.littleme').css('opacity',0).animate({opacity:1}, 1000);
    
    0 讨论(0)
  • 2020-11-28 23:52

    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.

    0 讨论(0)
提交回复
热议问题