Skip to content
Advertisement

problem with settimeout function in slideshow speeding up after about 5 interations

The following code I have implemented for a javascript slideshow appears to speed up after about 5 iterations, from once every 15 seconds to what appears to be about 1 second between transitions. Is there something wrong with how the jquery/javascript implements the setTimeout?

JavaScript
JavaScript

Thanks

Advertisement

Answer

Use setInterval instead. You are currently adding new setTimeouts for every loop

I changed the speed to not have to wait 15 seconds

I also shortened the code and after spending far too long trying to figure out why the blue image showed twice, I removed one of the TWO blue pictures

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement