PDA

View Full Version : Up-Down Image Slideshow - can it be stopped after one iteration?



davidstl
06-07-2007, 03:18 AM
1) Script Title: Up down slideshow Script

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

3) Describe problem: I am using the Up-down Image Slide show on a weblog and want to stop the slideshow after one time through the list of images. The slideshow works very well, but is a distraction for someone wanting to read the next post.

http://www.making-ripples.com/2007/06/wednesday_after.html

Is this possible?

Thanks,

David St Lawrence

jscheuer1
06-07-2007, 04:33 AM
First off, duplicate the last entry in your slide array and increase its number by 1, example (from the demo):


//configure the below variable to change the images used in the slideshow. If you wish the images to be clickable, simply wrap the images with the appropriate <a> tag
var slideimages=new Array()
slideimages[0]='<a href="http://www.cnn.com"><img src="PE01805A.gif" border="0"></a>'
slideimages[1]='<img src="PE01803A.gif">'
slideimages[2]='<img src="TN00411A.gif">'
slideimages[3]='<img src="PE02054A.gif">'
slideimages[4]='<img src="cake.gif">'
slideimages[5]='<img src="cake.gif">'
//extend this list

Then replace the four move functions with these:


function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
if(!startscroll.stop){
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
}
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1){
i=0
startscroll.stop=1
}
else
i++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
if(!startscroll.stop){
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
}
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1){
i=0
startscroll.stop=1
}
else
i++
}
}

function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+"px"
if(!startscroll.stop){
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2_obj)",pausebetweenimages)
}
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1){
i=0
startscroll.stop=1
}
else
i++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
if(!startscroll.stop){
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2_obj)",pausebetweenimages)
}
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1){
i=0
startscroll.stop=1
}
else
i++
}
}

davidstl
06-07-2007, 10:59 AM
Thanks for the code changes.
It makes a great difference in the presentation