In jQuery, I know that we can pass true or false value to the function to toggle visibility of an element. I can’t get slideToggle to do the same thing. Any help please?
For example, instead of:
if (true)
$('something').slideDown();
else
$('something').slideUp();
I would really like to do something similar to:
$('something').toggle(myBoolValue);
But I want to do it with slideToggle.
Look at my example of jsfiddle to know what I am trying to do.
Is that possible?
slideToggleoptionally takes 2 parametersdurationand acallbackso passing true/false to show/hide will not work. You might have to write your own plugin which will implement this logic. Something like this