Wednesday, 13 November 2013

Simple fade slideshow with jquery

JAVASCRIPT:
 
$( function() {
//launches a function each 3 seconds
setInterval(function() {
//fades out img and appends it to end
$('.slideshow img:first-child').fadeOut(500).next('img').show().prev().appendTo('.slideshow');
}, 3000);
}
 
HTML:
 
<div class="slideshow">
<img src="img1.jpg" style="position: absolute;">
<img src="img2.jpg" style="display:none; position: absolute;">
<img src="img3.jpg" style="display:none; position: absolute;">
</div>

No comments:

Post a Comment