Reputation: 52047
I have 2 classes: the helperopen and the helper. I'm writing a toggle that slides the helper div open or closed depending on its visibility. For the moment, it does the slideDown but it's not sliding up because the visibility condition test isn't working.
This is what I have so far:
$('.helperopen').click(function () {
if( $('.helper').is('visible') == true )
{ $('.helper').slideUp(); }
else {
$('.helper').slideDown();
}
});
Any suggestions are welcome.
Thanks.
Upvotes: 1
Views: 2103
Reputation: 1
The JQuery API explains how you can use the slideToogle function, details of which can be found at http://api.jquery.com/slideToggle/
There is a great example half way donw the page that you can copy and paste to understand how it works.
For your example, try $('.helper').slideToggle("slow");
Here, the function will either show or hide the text in 600 milliseconds (the value of "Slow")
Upvotes: 0