I've got a <td>
. It has a class applied which specifies a background color. Can I fade-in to a different class, which just has a different background color? Something like:
// css
.class1 {
background-color: red;
}
.class2 {
background-color: green;
}
$('#mytd').addClass('green'); // <- animate this?
Thanks
You could put a clone on top of it and fade the original out while fading the clone in.
After the fades are done, you could switch back to the original element... make sure to do this in the fades callback!
The example code below will keep fading between the two classes on each click:
jsFiddle example
.toggleClass()
.offset()
.fadeIn()
.fadeOut()