I've been working on this for several hours and I can't seem to figure out how to do this - I'm new to jQuery.
I want to fade out one div and then fade in another. I want to do this in sequence. I have tried putting fadeIn() in the callback of the fadeOut() function and queueing the two animations, but they still don't happen sequentially.
HTML:
<article id="foo">
<div>one set of content, initially set to "display: block;"</div>
<div id="bar">second set of content, initially set to "display: none;"</div>
<div id="menu">the menu, which I don't want to fade</div>
</article>
Here are the two methods I've tried:
Using queue():
$("#foo div:not(#bar, #menu)").queue( function() {
$(this).fadeOut('slow');
$(this).dequeue();
$("#foo div#bar").fadeIn('slow')
});
Using the callback:
$("#foo div:not(#bar, #menu)").fadeOut('slow', function() {
$("#foo div#bar").fadeIn('slow');
});
This should be relatively simple as it's one I've seen on many websites - what am I doing wrong?