PDA

View Full Version : stop looping slideshow



kaotob
10-27-2005, 05:42 PM
http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

is there a way to stop the slideshow after a certain number of loops and just leave the last image showing?

thanks,

newbie - Kelly

jscheuer1
10-27-2005, 10:09 PM
OK, in the configuration for the script add this line shown in red:


var slideshow_width='140px' //SET IMAGE WIDTH
var slideshow_height='225px' //SET IMAGE HEIGHT
var pause=3000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var loops=3 //SET NUMBER of LOOPS use 0 for continuous

Add this line (also shown in red) to the declared variables, a little ways down in the part of the script you are not supposed to edit:


var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
var loop=stop=0

Finally, add this code (in red) to the fadepic function:


function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/101
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=insertimage(nextimageindex)
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
if (stop)
return;
if (nextimageindex==0)
loop++
if (loops&&loop==loops)
stop=1
var tempobj2=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj2.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}

kaotob
10-27-2005, 10:38 PM
thank you, thank you!