I'm trying to find a way to make this smaller by using functions/variables in my jquery.
$('.search-what-category').fadeOut('normal', function(){
$('.search-wrapper').animate({'height':40})
})
$('.search-what-category').fadeOut('normal', function(){
$('.search-wrapper').animate({'height':40}, function(){
$('.search-wrapper').animate({'top':-60})
})
I can create the first snippet into a function, but the second snippet has an extra line in it (see the first and the second snippets are the same but the second one has an extra line of code). How would I create a function for the first snippet, and then be able to add into it the extra line shown in the second snippet? This is what I tried:
function hidecat(){
$('.search-what-category').fadeOut('normal', function(){
$('.search-wrapper').animate({'height':40})
})
}
hidecat($('.search-wrapper').animate({'top':-60}))
but that doesn't seem to work. I want the hidecat() function to activate and then when it's done, to activate the extra line of code, like in my example directly above this.