times image swap
i made an image gallery where you click on the next button and it shows the next image. click on it again and it shows the images after that, etc. pretty much the same thing happens with the previous button. now i have to make it "auto cycle" the images. click on a button and it calls a function. that function makes it cycle through the images with 5 seconds pause between each image. here is the code i have:
function startTimer(){
nextImage();
var timer = window.setTimeout('startTimer()',5000);
}
startTimer() is called when they click on the button to make it auto cycle. nextImage() is the code that makes the images switch out by going to the next image. timer is the name of my variables for the timeout. after 5 seconds is it suppose to call itself and do the same thing. this works on explorer but netscape it does not. any thoughts?
The trouble with doing something right the first time is that nobody appreciates how difficult it was.
AndyB posted this at 20:51 — 31st July 2000.
They have: 344 posts
Joined: Aug 1999
http://wsabstract.com/script/script2/incrementslide.shtml is an auto slideshow that might work for you
and here's another http://website.lineone.net/~mike_mcgrath/ (choose the slide show, maximise window and right click to see the whole code)
Rageforth posted this at 21:15 — 31st July 2000.
They have: 56 posts
Joined: Feb 2000
i figured out what the problem was. after 5 seconds when it called the nextImage() function, nextImage() at the same time called another function. if i make it not call the function it works in both browsers. i need nextImage() to call that other function though. is there a way to fix that?
The trouble with doing something right the first time is that nobody appreciates how difficult it was.
tazman posted this at 22:02 — 31st July 2000.
They have: 99 posts
Joined: May 1999
If you have the code, I can take a look at it, but in lieu of code, just a suggestion would be since all your start_timer(0 function does is to do a setTimeout, make the setTimeout call from within the next_image() function.
Tazman
Rageforth posted this at 22:16 — 31st July 2000.
They have: 56 posts
Joined: Feb 2000
i got it all figured out. turnes out i was missing apostrophies in a couple of places....oops. if anyone wants to source for it, i would be happy to give it to you. its like a "super-charged" image gallery as i call it. its about 165 lines of code. i like to space things out so i can find where things are so it's probably less lines than that. thank you all for your suggestions.
The trouble with doing something right the first time is that nobody appreciates how difficult it was.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.