That's much easier. Find the fadeshow.prototype.populateslide=function and replace it with this one:
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 (typeof this.theimages[picindex][3]!='undefined')
slideHTML+='<div>'+this.theimages[picindex][3]+'</div>'
else
slideHTML+='<div></div>'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
Now, you can add your captions into the image arrays as a fourth parameter:
Code:
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["photo1.jpg", "", "", "Kissing Fools"] // image syntax w/caption
fadeimages[1]=["photo2.jpg", "http://www.cssdrive.com", "", "Seated Woman"] //image with link syntax and caption
fadeimages[2]=["photo3.jpg", "http://www.javascriptkit.com", "_new", "The Dog Lovers"] //image with link and target syntax plus caption
If you want no caption, use either an empty set of quotes or skip it:
Code:
fadeimages[0]=["photo1.jpg", "", "", ""] // plain image syntax
or:
Code:
fadeimages[0]=["photo1.jpg", "", ""] // plain image syntax
If you do use any captions, be sure to increase the slideshow height in the call by about 20:
Code:
new fadeshow(fadeimages, 140, 245, 0, 3000, 1, "R")
You can control the font and other style for the caption from a style sheet in the head of the page:
Code:
<style type="text/css">
#slide1cap div div {
font-family:sans-serif;
text-align:center;
}
</style>
and wrapping the show's call in a span with the id of your selector:
Code:
<span id="slide1cap">
<script type="text/javascript">
new fadeshow(fadeimages, 140, 245, 0, 3000, 1, "R")
</script></span>
Bookmarks