I'm struggling with an image animation and can't quite figure out how to make it work.
<div id="img_loop">
<img src="img/img1.jpg" alt="image1" />
<img src="img/img2.jpg" alt="image2" class="hidden" />
<img src="img/img3.jpg" alt="image3" class="hidden" />
</div>
Both the second and third images have a 'hidden' class which makes them display: none in the CSS.
I want these three images to create a continuous loop, transitioning between each one by toggling the 'hidden' class so that only one is visible at a time.
This is what I've been experimenting with:
$(function(){
setInterval("updateImage()", 2500);
})
function updateImage() {
var $active = $('#img_loop img').not('hidden');
var $next = $active.next();
$active.fadeTo(1000, 1.0, function(){
$active.addClass('hidden');
$next.removeClass('hidden')
})
}
Thank you for any assistance provided :)