PDA

View Full Version : Ultimate fade-in slideshow modification: stop sliding



BelliLint
10-05-2006, 05:44 AM
1) Script Title: Ultimate fade-in slideshow

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

3) Describe problem: I'd like to modify the script so that it shows the whole array of images only once. I don't want it to repeat the images. When the last image appears, I'd like it to remain on the last one.

I've put in my time trying to figure it out myself, but my coding days are obviously too far in my past and I'm rusty. Help please!

jscheuer1
10-05-2006, 06:46 AM
See this thread:

http://www.dynamicdrive.com/forums/showthread.php?t=13344

BelliLint
10-05-2006, 03:45 PM
Thanks, that's almost it! One small difference I need in the script, though.

I don't want to end the slideshow on the first image - I want to end it on the last image.

jscheuer1
10-06-2006, 04:59 AM
Find this line:


obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
if(obj.flag){
obj.mouseclickcheck=1
obj.flag=0
}
if(obj.nextimageindex==obj.postimages.length-1)
obj.flag=1
obj.populateslide(obj.tempobj, obj.nextimageindex)


Make the 1 a 2:


if(obj.nextimageindex==obj.postimages.length-2)

If you want to retain the ability of the user to start/restart the show with a click, find this line as well:


fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (picindex==this.theimages.length-1)
slideHTML+='<img style="cursor:pointer;" title="Click to Start" src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
else
slideHTML+='<img title="" src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
picobj.innerHTML=slideHTML

Make it like so:


if (this.flag&&picindex==this.theimages.length-2|this.theimages.length-1)

BelliLint
10-06-2006, 04:32 PM
Awesome John, that did it! I played with it all day yesterday and had made some other fudgey changes (skipping the array shuffling at the beginning, starting on the first element of the array instead of the last) but there remained a flash of the last image at the beginning of the show.

Thank you for taking the time and sharing your know-how.

Andrea