PDA

View Full Version : Ultimate Fade-in slideshow image width



nevdev
01-27-2007, 10:42 PM
1) Script Title: Ultimate Fade-in slideshow (v1.5)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: (Not a problem, but a "tweak-possible" question): Is it possible somehow to specify a new 'virtual' width for each image in the slideshow? That is, my script might draw upon a directory of images that are all say, 600px wide, but can I specify in the js somehow that they should appear at a smaller size, say, 400px wide (like doing "width="400" in HTML)?

jscheuer1
01-27-2007, 10:51 PM
As the script is written, you would have to modify it. If you only have one show on the page, it is easier to just go here:

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 width="400" src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}

and add in the width that you want as shown above in red.

If you have more than one slide show on the page and each slide show needs a different width set, it can be done but is a little more complicated. Let me know if you need that. You are better off (for many reasons) resizing your images in an image processing program.

nevdev
01-27-2007, 11:01 PM
I do have only one slideshow on the page in question, and the change is indeed only from 600px to 400px wide, so I don't think there's much overhead.

Thank you very much! That's brilliant!