...

View Full Version : Help with image rotation slide show



schnarkle
06-29-2012, 10:23 PM
Hello,

I inherited taking over a site and the main page has a slide show of 4 images. It is freezing on the last image instead of looping. Can anyone help?

Code:

function rotateImages( imageList, imageInterval ){
if( imageInterval == null ) {
var imageInterval = 7000;
}
var myImageItem = imageList + "> li.imageItem";
var fadeInTime = 500;
var imageFadeTime = 2500;
//var imageCount = $( myImageItem ).length;
var imageCount = 4;
var currentImage = 0;

// set up first item
$( myImageItem ).eq(currentImage).fadeIn(imageFadeTime);


// loop through images
var theBigLoop = setInterval( function() {
$( myImageItem ).eq(currentImage).fadeOut(imageFadeTime);
if( currentImage == imageCount ){
currentImage = 0;
} else {
currentImage++;
}
$( myImageItem ).eq(currentImage).fadeIn(imageFadeTime);
}, imageInterval); // end of setInterval

} // end of rotateImages

The site is here: http://www.crunchpak.com

thanks!
Reply With Quote

hdewantara
07-01-2012, 09:52 AM
You could make that currentImage global, by removing the "var" from its line (see the bolded words below):

function rotateImages( imageList, imageInterval ){
...
currentImage = 0;
...


Or maybe this one:


var currentImage = 0;
function rotateImages( imageList, imageInterval ){
...
//var currentImage = 0;
..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum