Sercan
Sercan

Reputation: 325

How can I animate the background color of a table using JQuery?

I have a table with some styling. It's like:

<table class="table_design" id="cart">
   <tr>
       <td>something</td>
       <td>something else</td>
   </tr>
</table>

I tried:

$("#cart").animate({backgroundColor: '#FF0000'}, 'slow');

and

$("#cart").effect("highlight", {}, 3000);

But, They both are not working.

What do you recommend?

Upvotes: 1

Views: 1853

Answers (2)

Musa
Musa

Reputation: 97672

You need jquery-ui to do animation on background colour. fiddle

Upvotes: 1

Sampson
Sampson

Reputation: 268344

Include jQuery UI into your project and the .animate method will animate colors.

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.20/jquery-ui.min.js"></script>

You can get it from a CDN hosted by either Microsoft or Google.

Upvotes: 3

Related Questions