actually it works great already, only thing is that the first function inside toggle() always gets fired first, so if the #searchbox is already visible and slidedDown it should immediately trigger the slideUp function and vice versa.