I have solved the timeout problem by changing to timer = setInterval() and timer = clearInterval() like I should have done in the first place.
I still have the question about stopping or speeding up a fade effect. An ideal solution would be to skip to the very end of the effect. Is this possible? Thanks. On Apr 18, 10:16 am, Brandon <[EMAIL PROTECTED]> wrote: > I have a FadeOut and FadeIn effect that happens because of a recursive > setTimeout(). I also want to have an action that lets the user pause/ > stop the actions, but I am having problems with that "pause" action. > > Simplified code: > var auto_fade = function() { > fadeTo(changeTo_el); > timer = setTimeout(auto_rotate, (settings.timeout+settings.speed));} > > var pause = function() { > clearTimeout(timer); > > } > > Now I would expect for this to kill the timer and stop the auto_fade, > but it doesn't seem to. For some reason, I need to have a > clearTimeout(timer); for each setTimeout() that is run in order to > stop the looping. Is this normal? What's the proper way to cancel > all setTimeout()'s associated with var timer? > > Also, my fadeTo function is: > var fadeTo = function (changeTo_el) { > $(elements[current_el]).fadeOut(settings.speed); > $(elements[changeTo_el]).fadeIn(settings.speed); > > current_el = changeTo_el; > > } > > Is there a way to cancel a fadeIn? Or skip to the end of the event? > What I would like is if someone were to hit pause, it jumps to when > the element being faded in is finished (shown at 100%).