Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does using a webkit-transition with text result in the text snapping at the end?

Please see the following: http://jsfiddle.net/2Vdef/1/

When you move your mouse over the div, the text animates in but right at the end has a very unattractive snap into opacity:1. Why so abrupt? How can this be made smooth? Thanks

like image 988
AnApprentice Avatar asked Feb 19 '23 08:02

AnApprentice


2 Answers

I've run into the same problem, and while this solution doesn't work in my case it does in yours.

http://jsfiddle.net/2Vdef/13/

Add backface-visibility.

-webkit-backface-visibility: hidden;
-moz-backface-visibility:    hidden;
-ms-backface-visibility:     hidden;
backface-visibility:         hidden; 

EDIT: The solution in my case was indeed backface-visbility. You just need to apply it to the correct element. I animated the opacity of a, and assumed that backface-visbility needed to be applied to a. Instead, it needed to be applied to the container of a.

Not working: http://jsfiddle.net/9PmXu/ Fixed: http://jsfiddle.net/9PmXu/1/

like image 127
Luqmaan Avatar answered Apr 06 '23 10:04

Luqmaan


It looks fine on Chrome and FF Win 7 / OS X to me, but on IE of course no gradual opacity change. For all browsers, you could try to achieve the same effect with jQuery and tweak the animation speed as you like. http://jsfiddle.net/2Vdef/8/

like image 34
Slavenko Miljic Avatar answered Apr 06 '23 09:04

Slavenko Miljic