I am currently working on enhancing my search bar using jQuery, and I am also looking to hide the navigation links.
Here is a snippet of the jQuery code I have been using. The code functions properly when focused.
$(".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 properly, except that it displays the content before the animation is complete.
Therefore, I am looking for a way to ensure that
$("#navlinks").css('display','block');
is only executed once the animation is complete.
If anyone knows how to achieve this, I would greatly appreciate the help.
Thank you