My apologies is this is a double post - It seems Google Groups just dropped my last message (I'm not even sure how that's possible), so here goes.
A little over a year ago, user Iminay requested help in getting some of his code to properly pause after a fade event before continuing with execution: http://groups.google.com/group/jquery-en/browse_thread/thread/bbe0471b780e666a It seems he was able to resolve his problem after two extremely helpful responses were posted. Unfortunately, I haven't had the same success, and even after trying to follow the solutions posted by David McFarland or Karl Swedberg, I'm still confused and unable to modify their code to solve this particular problem. Specifically, I have a jQuery-based image rotator that is mostly governed by this chunk of code: // The below function repeatedly gets called by setInterval ("show_next_rotating_item(showing)", 5000), to do the rotating function show_next_rotating_item(t) { jQuery(t).fadeOut(2000); var next_rotating_item = jQuery(t).siblings('.rotating_item:random'); if(!next_rotating_item.attr('class')){ next_rotating_item = jQuery('#rotating_items div.rotating_item:first'); } //Pause for some user defined amount of time HERE! next_rotating_item.fadeIn(1000); showing = next_rotating_item; } As you can see, it's a fairly simple chunk of code... And as indicated by the comment, I'm trying to pause in between a fadeOut() and fadeIn () function call. I've tried adapting David and Karl's suggestions, but I haven't had much success. I've also looked into setTimeout(), but it seems that function doesn't produce the desired behavior - it does indeed execute the passed function after a specified delay, but doesn't seem to do it in a serial fashion. That is, it seems to spin the execution of that function off into another process, continue on with the next line of code, and then executing the spun-off function in parallel after the appropriate delay. In other languages I'm familiar with, there have always been a sleep (), wait(), pause(), etc. function that one can call to pause the serial execution of a function for a given amount of time. How might one achieve that here? In the solutions posted by David and Karl in the aforementioned link, there was mention of "callback functions". I read up on how they work, but I don't see how I can apply them to this situation. The code those two posted is much more... complex... than what I can read, and I was hoping someone could make it a bit more simple. While theirs is nice and compact, it's less human/programmer-readable, and that's what I need right now. Does anyone have any ideas? I'm sorry if the solution is obvious or self-evident... I'm not as proficient at JavaScript as I am at some other languages and I'm still learning.