use javascript create images gallery, ratate images fucntion

var i =0;
function rotate1(){
    var imgArray = new Array(“aphex”,”addiction”,”amy”,”abba”,”donna”,”elliott”,”fergie”); //store images in an array
    picName=imgArray[i];
   //change div picture1 background images
   document.getElementById(‘picture1’).style.backgroundImage = “url(images/product/”+ picName +”.jpg)”;
   ( i == (imgArray.length – 1 )) ? i = 0 : i++; //if (i = 6){ change i=0} else {i++}
}
window.setInterval(rotate1, 2000);//change every 2 seconds

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s