I am trying to expand my search bar with jQuery. I also want to hide the navigation links.
I have jQuery code similar to this one. This code works great when focusing.
$(".searchBox input").focus(function(){ $("#navlinks").css('display','none'); $(this).css({'width':'200px','-moz-transition':'width 0.5s ease-out','-webkit-transition':'width 0.5s ease-out','transition':'width 0.5s ease-out'}); }); $(".searchBox input").focus(function(){ $(this).css({'width':'100px','-moz-transition':'width 0.5s ease-out','-webkit-transition':'width 0.5s ease-out','transition':'width 0.5s ease-out'}); $("#navlinks").css('display','block'); });
The second function also works fine except it display the content before animation complete.
So I want $("#navlinks").css('display','block'); was displayed only after the animation was completed.
Can anyone tell me how?
thanks
source share