0

I am trying to change the fade in a different background-color of my tag through console. I am using the command $('body').animate({backgroundColor: "#fff"}, 'slow'); that I got from this thread but all it does it returns the jQuery object which represents body. I do have jQuery included.

How can I transition to another background color through console? enter image description here

Community
  • 1
  • 1
chopper draw lion4
  • 12,401
  • 13
  • 53
  • 100

2 Answers2

3

By default you can't animate background with jQuery:

From animate jquery doc :

All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color() plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.

But you can use a plugin :

eg: https://github.com/jquery/jquery-color

amiceli
  • 437
  • 5
  • 11
  • 29
0

if you can do without animate. try this :

document.getElementsByTagName('body')[0].style.backgroundColor='#000';
shifu
  • 6,586
  • 5
  • 21
  • 21