I would like to animate the background when I change the class of the .btn buttons, for example passing from a .btn-primary with loading on to a .btn-success or .btn-danger.
Right now, if I add -webkit-transition: background 1s linear to the .btn class and use js to switch the classes, the change is not animated
(Point of interest: i tried adding the css transition directive only in the chrome element inspection tool.)
Any idea?
UPDATE: if the button is in disabled mode the transitions work, maybe the problem is due to the use of css3 gradients as background-images which maybe are not supported by -webkit-transition?
I think you nailed it in your update. CSS can transition background colors and position, but not between gradients, which would be required to animate those.
Here’s an idea for a desperate workaround if you’re interested:
If you do this all fast enough, you may be able to pull off a decent effect. I’d be curious to see it if you give it a try.