Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
28
rated 0 times [  32] [ 4]  / answers: 1 / hits: 141121  / 12 Years ago, sun, june 24, 2012, 12:00:00

I have a section on my website that when a user clicks I would like it to expand, I'm using the jQuery's toggleClass for this...



expandable: function(e) {
e.preventDefault();
$(this).closest('article').toggleClass('expanded', 1000);
}


This is working fine, only I'd like to somehow animate it. In chrome my article slowly grows to the new size, only in Firefox it 'instantly' resizes itself with no animation, is there a way to have this animate?


More From » jquery

 Answers
46

jQuery UI extends the jQuery native toggleClass to take a second optional parameter: duration



toggleClass( class, [duration] )


Docs + DEMO


[#84696] Friday, June 22, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
devonw

Total Points: 311
Total Questions: 116
Total Answers: 111

Location: Senegal
Member since Fri, Aug 21, 2020
4 Years ago
;