Use javascript build slide show, this is the implement source code

In previous post the slide show has a little problems, when you click next then click previous, it change to the correct picture, but when you click 2 times or more then 2 times. It won’t change back to the correct picture. the reason cause this problems is i set counter =0,in the beginner, so this cause the problems.

here is the source code solve this problems; and much easy.

var imageArr = new Array(“addiction”, “amy”,”abba”, “aphex”,”backstreet”, “bjork”, “bowie”, “donna”,”elliott”, “fergie”, “groove”, “him”,”jeff”, “kanye”, “linkin”, “lisagerrard”,”maddy”, “mariah”, “marvin”, “mary”,”melon”, “neyo”, “nick”, “nin”,”pumpkins”, “rhcp”, “rihanna”, “rob”,”rufus”, “seether”, “staticx”, “stereophonics”,”tim”);
var imageDescArr = new Array (“Addiction”, “Amy”, “Abba”, “Aphex”,”Backstreet”, “Bjork”, “Bowie”, “Donna”,”Elliott”, “Fergie”, “Groove”, “Him”,”Jeff”, “Kanye”, “Linkin”, “Lisagerrard”,”Maddy”, “Mariah”, “Marvin”, “Mary”,”Melon”, “Neyo”, “Nick”, “Nin”,”Pumpkins”, “Rhcp”, “Rihanna”, “Rob”,”Rufus”, “Seether”, “Staticx”, “Stereophonics”,”Tim”);
imgCt = imageArr.length-1;

function chgSlide(direction)
        thisPic = thisPic + direction;
        if(thisPic > imgCt)
            thisPic = 0;        
        if(thisPic < 0)
            thisPic = imgCt;




Leave a Reply

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

You are commenting using your 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