Reputation: 4403
New to jquery here and I'm trying to use the toggle function to show and hide a div, while also adding an active class and removing an active class.
I'm having 2 problems:
1) the 'active' class won't toggle off when you click the link to close the div, it says highlighted.
2) When you toggle the div closed by clicking the link again, the div doesn't animate up to close it just disappears. How can I get the animation when i toggle show to work when I toggle close?
Would really appreciate any help, thanks a lot!
Upvotes: 0
Views: 241
Reputation: 2311
Is this what you want? http://jsfiddle.net/MAky9/1/
I removed the 0 from the toggle calls, and I switched addClass() to toggleClass()
I also tweaked some styles so I could see what's happening.
Upvotes: 1