Ok, to add an optional textual description to Ultimate Fade In slideshow, do the following:
Step 1: Modify your images array by adding a 4th parameter to each element:
Code:
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["../photo1.jpg", "", "", "I'm George"] //plain image syntax
fadeimages[1]=["../photo2.jpg", "http://www.cssdrive.com", "", "I'm Sarah"] //image with link syntax
fadeimages[2]=["../photo3.jpg", "http://www.javascriptkit.com", "_new", "Who are you?"] //image with link and target syntax
As you can see, the 4th parameter now contains the text you want shown beneath the image in question. Remove this parameter for images that you don't want a description.
Step 2: Then, modify function populateslide() with the below small change:
Code:
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
if (typeof this.theimages[picindex][3]!="undefined") //if this image contains a description
slideHTML+='<div>'+this.theimages[picindex][3]+'</div>'
picobj.innerHTML=slideHTML
}
That's it. Be sure the height of your slideshow is tall enough to contain the descriptions, or they'll be clipped:
Code:
new fadeshow(fadeimages, 140, 325, 0, 3000, 1, "R")
Bookmarks