jQuery How do you get an image to fade in on load?

前端 未结 13 1671
情话喂你
情话喂你 2020-11-29 04:21

All I want to do is fade my logo in on the page loading. I am new today to jQuery and I can\'t managed to fadeIn on load please help. Sorry if this question has already been

13条回答
  •  没有蜡笔的小新
    2020-11-29 04:39

    Using Desandro's imagesloaded plugin

    1 - hide images in css:

    #content img { 
        display:none; 
    }
    

    2 - fade in images on load with javascript:

    var imgLoad = imagesLoaded("#content");
    imgLoad.on( 'progress', function( instance, image ) {
        $(image.img).fadeIn();
    });
    

提交回复
热议问题