Attention JavaScript gurus: Need a hand with setInterval()
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-06-16T01:10:42Z
Indexed on
2010/06/16
1:12 UTC
Read the original article
Hit count: 302
I am trying to make a non interactive display for a real estate shop window.
It's been a while since I've played with setInterval()
.
The first time my script steps through, it is fine. But when it tries to get the next property via getNextProperty()
, it starts to go haywire. If you have Firebug, or an equivalent output of console.log()
, you'll see it is calling things it shouldn't!
Now there is a fair bit of JavaScript, so I'll feel better linking to it than posting it all.
It is worth mentioning all my DOM/AJAX is done with jQuery.
I've tried as best to make sure clearInterval()
is working, and it seems to not run any code below it.
The setInterval()
is used to preload the next image, and then display it in the gallery. When the interval detects we are at the last image ((nextListItem.length === 0)
), it is meant to clear that interval and start over with a new property.
It has been driving me nuts for a while now, so anyone able to help me?
It is probably something really obvious!
Many thanks!
© Stack Overflow or respective owner