I'm trying to put together an animated drop-down menu of my own in jQuery but am getting weird results. I have a container wrapping a button DIV and a menu DIV, and the idea was to have (on mouseover) both the container DIV and menu DIV scale in height with the menu DIV getting a CSS {'display', 'block'}. On mouseout of the container DIV (which is supposed to have scaled in height to contain both the button and menu DIVs) I wanted the DIVs to scale back to their original heights and the menu DIV to get a CSS {'display','none'}.
The problem now is that after everything scales up, instead of scaling back on mouseout of the supposedly scaled-up container (height: 300px), the scaling begins after mousingout of the container's original height (height: 100px), not the new one.
Here's the code:
$('.container').mouseover(function(){
$('.bob').css('display','block');
$('.bob').animate({height: '200px'});
$(this).animate({height: '300px'});
});
$('.container').mouseout(function(){
$('.bob').animate({height: '0'},
function(){
$('.bob').css('display','none');
});
$(this).animate({height: '100px'});
});