Reputation: 14510
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
Upvotes: 2
Views: 1776
Reputation: 47687
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
Upvotes: 1
Reputation: 5247
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/
Upvotes: 0