2

Can I make this: http://jqueryui.com/demos/switchClass/default.html without jQuery UI?

Basically I have a simple site which the body has a class named: '.bgone'.

.bgone has background color: #ccc and I want to toggle the .bgtwo of which backgroundcolor is #999 with the fade effect.

Is it possible with only jQuery?

Thanks

jQuerybeast
  • 14,130
  • 38
  • 118
  • 196
  • I don't know how this would show background colors, but have you tried using jQuery [.animate()](http://api.jquery.com/animate/)? – Andrew Jackman Jan 04 '12 at 23:33

2 Answers2

1

You can not animate colors with jQuery alone. You might need some plugins - it's still a separate file (and maybe a separate HTTP request), but significantly smaller then the UI.

Some of those

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

Unfortunately, to fade between background colors, you need JQuery UI or something similar. You might try this color animation plugin, or alternatively, use CSS3 transitions and simply use jQuery to toggle animated classes.

Here is an example of CSS3 color animation with a JavaScript/JQuery trigger: http://jsfiddle.net/6nRj2/

Aaron
  • 5,137
  • 1
  • 18
  • 20