PDA

View Full Version : conveyor belt script - how can I make it stop?



nefm2004
03-03-2009, 06:22 PM
1) Conveyor Belt Script:

2) http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

3) Describe problem:

No basic issue getting the script up and running (www.garden-cgc.org (http://www.garden-cgc.org)); however, I've been asked whether or not there is a way to program the script to stop running after the slideshow runs a few times.

Is it possible to get it to run through once or twice and make it stop from there?

Thanks!
Jess

jscheuer1
03-04-2009, 05:16 AM
Replace the existing slideleft function with this one (additions highlighted):


function slideleft(){
if (iedom){
if (slideleft.count == 0){
clearInterval(lefttime);
return;
}
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else{
slideleft.count = ++slideleft.count || 0;
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
}
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else{
slideleft.count = ++slideleft.count || 0;
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}

The red 0 controls how many times the contents will pass by, 0 is once only, 1 would be twice, and so on.