How do I create a fade-in load effect, one after another image

你。 提交于 2019-12-11 06:52:51

问题


I've got inspired by the thumb loading effect on this page, but honestly got no clue how to create such effect, on each thumb.

Who could point me in the right direction, or even give me some lines of codes?

I've seen some other topics related, but those won't work in a situation where many images will be loaded, one after another.

Thanks!


回答1:


The script :

$(function(){
    $("#listing .img").each(function(index) {
        $(this).hide().delay(100*index).fadeIn(300);
    });
});

Then the html :

<div id="listing">
  <div class="img"><img src="http://www.marclagrange.com/files/thumbs/medium/snow-white20091.jpg" alt=""  width="235" height="180" /></div>
  <div class="img"><img src="http://www.marclagrange.com/files/thumbs/medium/soeur-sourire70x50.jpg" alt=""  width="235" height="180" /></div>
</div>

And do not forget to include jquery.

Here is a jsFiddle.



来源:https://stackoverflow.com/questions/20072807/how-do-i-create-a-fade-in-load-effect-one-after-another-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!