Reputation: 2354
I use this code for toggleClass the show and hide class .This worked but not true .In this case 1 second wait and then run toggleclass with out animation.
$(function () {
$("#open_search").click(function () {
$("#search").toggleClass("show",1000);
$("#open_search").toggleClass("hide",1000);
});
});
Upvotes: 0
Views: 58
Reputation: 644
I suggest you use toggle() instead of toggleClass() if you are just looking forward to hide or show the element,But if you are thinking of creating many elements with "show" or "hide" classes you will need to add additional css code to just hide the elements...so toggle() is better
Upvotes: 0
Reputation: 8355
My guess: You don't want toggleClass()
, but rather toggle()
. Try:
$("#search").toggle();
Upvotes: 2