I'm trying to create a pulsate effect on a table entry that's being inserted into a table with $.ajax.
The table rows have odd / even classes that make the table look like a zebra (odd rows have lighter background).
When a new table row is added, it will be appended to the table, so I'm just checking if the last row (table tr:last
) has an "odd" class. If it does then I'm adding the "even" class to the newly appended row, otherwise I'm adding the "odd" class to it.
Anyway how can I make the new row fade from red to whatever background color odd/even classes are applying to it.
I tried with:
new_row.addClass(odd_or_even_class); // here the class is decided
var currentColor = new_row.css('background-color');
new_row.css('background-color', '#FF99CC')
.animate({backgroundColor: currentColor}, 1000);
But for some weird reason it fades to white...
I think it has something to do with the value of the "currentColor" variable which looks like rgba(...)
instead of a hex value. And maybe $.animate only accepts hex values?