Seeking assistance from the talented individuals here. Currently in the process of constructing a website for a client, and one of the key components on the index page is an image slider/fader that showcases a series of images. The client has requested a unique transition effect where the next image in the sequence fades in as grayscale and slowly transitions to color before pausing briefly and loading the following image.
I have successfully implemented an image fader for the transition effect but am now looking to incorporate the grayscale feature. As a newcomer to jQuery, I have found limited resources online and am facing some challenges.
Here is my CSS:
.index_slideshow { position:relative; height:340px; width:980px; margin:auto; }
.index_slideshow IMG { position:absolute; top:0; left:0; z-index:8; }
.index_slideshow IMG.active { z-index:10; }
.index_slideshow IMG.last-active { z-index:9; }
Here is my jQuery code:
function slideSwitch() {
var $active = $('.index_slideshow IMG.active');
if ( $active.length == 0 ) $active = $('.index_slideshow IMG:last');
var $next = $active.next().length ? $active.next()
: $('.index_slideshow IMG:first');
$active.addClass('last-active');
$next.css({opacity: 0.0 })
.addClass('active')
.animate({opacity: 1.0}, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval( "slideSwitch()", 5000 );
});
And here is my HTML markup:
<div class="index_slideshow" id="index_slideshow">
<img src="images/img2.jpg" alt="" />
<img src="images/img.jpg" alt="" />
</div>
Any help or advice would be greatly appreciated! :-)