resting — 2012-04-20T16:17:22-04:00 — #1
I always tend to have this problem.
Say I try to do something like that
get_current_image will return the wrong result, because the animation for the slide_image() has not ended.
Is there a wait function or something?
setTimeout is not that ideal too since multiple calls stacks up the queue.
paul_wilkins — 2012-04-20T19:46:06-04:00 — #2
That can depend on the code library that you are using. Which particular image slider are you using?
resting — 2012-04-22T22:42:21-04:00 — #3
Actually I wrote my own, based on the tutorial here: http://jonraasch.com/blog/a-simple-jquery-slideshow
I was using jQuery's animate function and could throw my ending script in the complete method.
But I keep hitting this problem and wonder how I can over come it by manually injecting a waiting script.
That is, instead of writing my ending script in the complete method, write it after I call the animate function.
Its easier to read that way too.
paul_wilkins — 2012-04-22T22:44:04-04:00 — #4
What is normally done is to pass a callback function to the slider, so that when your animation comes to an end, the callback (if any) can then be called.