Liam Liam - 9 months ago 170
Javascript Question

ToggleClass animate jQuery?

I have a section on my website that when a user clicks id like it to expand, Im using the jQuery toggleClass for this...

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

This is working fine, only Id 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?


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

toggleClass( class, [duration] )

Docs + DEMO