I'm trying to do a simple image slideshow similar to what you see
here: http://www.okadirect.com/

When the image changes, I want there to be that sort of "flash" effect
that fades out to reveal the image.

Looking around on the jquery website, I found this
http://docs.jquery.com/UI/Effects/Highlight, which seems to be the
effect I'm looking for, but I can't figure out how to implement it to
my existing slideshow script (which I got from here:
http://jonraasch.com/blog/a-simple-jquery-slideshow

The slideshow script from that website uses a fade in transitioning
effect between the images, which is nice and all, but I've really been
spending hours trying to figure out how to implement that highlight/
flash effect into it.

So, as you can clearly see, I have no javascript experience and any
help would be really really appreciated. It seems like such a simple
thing to do but I can't figure it out.

My current script:

JS

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the
markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order

    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $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()", 3000 );
});


CSS

#slideshow {
    position:relative;
    height:350px;
    margin-left: 260px;
}

#slideshow IMG {
    position:absolute;
    border: 5px solid #B99E75;
    height: 400px;
    width: 500px;
    top:0;
    left:0;
    z-index:8;
}

#slideshow IMG.active {
    z-index:10;
}

#slideshow IMG.last-active {
    z-index:9;
}

Reply via email to