Dan
Dan

Reputation: 12096

jQuery animate toggle show an element only

I'm trying to use jQuery to animate and show a hidden element, however at the moment I can only make it so it will toggle the element and not just show it only.

$("#testTab").animate({"height": "toggle", "opacity": "toggle"}, "slow" );

Basically I want to achieve:

$("#testTab").toggle("slow");
$("#testTab").toggle(true);

but that would make a double toggle and both parameters can't go into one toggle?

Upvotes: 0

Views: 829

Answers (1)

PriorityMark
PriorityMark

Reputation: 3247

If you're trying to just make it so that you click it once, and it animates the showing of it, just use.

$("#testTab").show("slow");

If you're trying to make so that it toggles (click once it shows, click again and it hides, animation in both directions). Just use the toggle parameter, that's what it does:

$("#testTab").toggle("slow");

Upvotes: 1

Related Questions