0

I'm trying to figure out how to just fade in the css background color of my site. However, i'm just getting background images with divs or tags in order to fade them. No examples of just a css background color fade in.

 <style type="text/css">
 body {
    background-color: #F00;
 }
 </style>

Any help would be great in figuring this simple problem out.

David

StealthRT
  • 10,108
  • 40
  • 183
  • 342

2 Answers2

2

You can't animate colors directly with jQuery, however plugins exist to help you out - http://www.bitstorm.org/jquery/color-animation/ for example

Zoltan Toth
  • 46,981
  • 12
  • 120
  • 134
1

There are several plug-ins available that easily accomplish this functionality:

jQuery Color Plugin

jQueryUI Color Animations:

Bitstorm Color Animation

Usage for nearly all of them:

$('body').animate({ backgroundColor: "White" }, 'slow');


$(this).animate({ backgroundColor: "black" }, 1000);
Rion Williams
  • 74,820
  • 37
  • 200
  • 327