简体   繁体   中英

Fade In/Out Multiple Images JQuery PHP

I have a code like this.

<div id="all_sign">
<img src="images/sign1.jpg" id="sign1" />
<img src="images/sign2.jpg" id="sign2" />
<img src="images/sign3.jpg" id="sign3" />
<img src="images/sign4.jpg" id="sign4" />
<img src="images/sign5.jpg" id="sign5" />
</div>

The output should be like this first.
sign1.jpg sign2.jpg sign3.jpg sign4.jpg sign5.jpg

After loading all the five images,each image should fade out randomly (say for 2 seconds), and again it should fade in(after 2 seconds).

Hope this explanation is more than enough.

Thanks Haan

something like this should work:

$('#all_sign img').each(function(index){
   $(this).delay(index*1000).fadeIn(500,function(){ $(this).fadeOut(500); });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM