jQuery hiding dropdown after animation -
i'm trying solve problem here.
the following jquery script dropdown menu of mine.
all following code works me, except there's 1 hitch i've run into.
if click on 1 of .drop class 'a' links dropdown, comes down following animations listed in code below. unfortunately, when click on .drop class 'a' link, other dropdown doesn't go away.
i've tried using $("ul.dropdown").hide(); cancels out animation of if(thedropstate){ .. } making disappear instantly.
can me find solution making hide itself, after if(thedropstate){ .. } animation done?
i've tried putting $("ul.dropdown").hide(); in callback function, didn't work either.
$(".drop").click(function(event) { var thedrop = $(this).next("ul.dropdown"); thedropstate = thedrop.is(':visible'); if(thedropstate){ thedrop.stop(true,true).animate({ height: 'hide' }, '200'); $('#header').stop(true,true).animate({ height: '50px' }, '200', function(){ $("ul.dropdown").hide(); }); } else if(!thedropstate){ thedrop.stop(true,true).animate({ height: 'show', opacity: 'show' }, '200') $('#header').stop(true,true).animate({ height: '100px' }, '200') } any , appreciated.
use callback
$('#foo').animate({height: '200px'}, 200, function(){ /* stuff */ });
Comments
Post a Comment