Reputation: 1049
So I have nav bar, with a search bar on top of it. When you want to search it'll appear. And when you're done it'll slide back up. The issue is, I can't get it to slide back up, I can only get it to slide down. Here's my code
$(document).ready(function(){
$(".icon-search").click(function(){
$(".slip").toggleClass("slip-open");
$("#FORM_1").removeAttr("style");
});
And a demo for the thing with CSS and markup http://jsfiddle.net/FjwPZ/2/
You'll see that the search bar slides down, but not back up. Any help would be great.
Upvotes: 1
Views: 26
Reputation: 6411
Use toggle()
instead of removeAttr
Toggles each of the set of matched elements. If they are shown, toggle makes them hidden. If they are hidden, toggle makes them shown.
Try this:
$(document).ready(function(){
$(".icon-search").click(function(){
$(".slip").toggleClass("slip-open");
$("#FORM_1").toggle();
});
Upvotes: 1