i'm trying to make smooth animation during change class with Jquery.
But it works only with text-color, not background.
You can check this for detail :( :
i'm trying to make smooth animation during change class with Jquery.
But it works only with text-color, not background.
You can check this for detail :( :
This is simply a matter of version of the libraries.
Your jsbin shows jQuery 1.3.2 and jQuery UI 1.7.2.
In this jsfiddle (with jq 1.3.2 and jqui 1.7.2), it does not work.
In this other one, latest versions of both libraries, it works.
jQuery 1.3.2 is more thand legacy, you should not use it anymore, except if you don't have the choice, but then you should expect some (over-the-top) things not to work I'm afraid.
Animating gradients
Looking at the documentation from jQuery UI, they seem not to support gradient on the overloaded .animate() to animate colors (doc). I guess it just works with solid colors.
The jQuery UI effects core extends the animate function to be able to animate colors as well. It's heavily used by the class transition feature and it's able to color animate the following properties:
- backgroundColor
- borderBottomColor
- borderLeftColor
- borderRightColor
- borderTopColor
- color
- outlineColor
with one of the following combinations:
- hex (#FF0000)
- rgb (rgb(255,255,255))
- names ("black")
CSS transitions on the other hand does not handle gradients neither in any browser. There any several workarounds though:
A word on YouTube's buttons you mention.
For me, the gradients are not animated as they use CSS transitions. Here is how I tested that:
<button>
element.[-*-]transition: all 0.218s;
to "1s"My opinion is that the animation of the border (etc) gives the impression the gradient is animated but it's not.
I don't understand why you use javascript:$(this).removeClass("hoverf",1000)
, what is the second parameter of removeClass for? And I don't find any problem, it just works fine in chrome.