CSS3 transition for :after pseudoelement

半世苍凉 提交于 2019-12-01 17:54:29

问题


Check out this fiddle: http://jsfiddle.net/sajYc/

The transition for the :after pseudo element works in firefox, but fails in webkit based browsers. Any idea if this is coming up in a future release? Any non-jquery overkill workarounds for it?

Basically, I'm using it on a page to fade between two states of a background image sprite(instead of two colors like in the fiddle). A smooth transition between an icon's normal and hover state. So I don't want to add a bunch of actual elements to it just to make this animation work.


回答1:


Unfortunately, this is a known issue in Webkit browsers and IE:

http://css-tricks.com/13555-transitions-and-animations-on-css-generated-content/

However, fading between image sprite states is do-able in jQuery. This tutorial gives a good run down:

http://www.tutorial9.net/tutorials/web-tutorials/creative-button-animations-with-sprites-and-jquery-part-2/



来源:https://stackoverflow.com/questions/7922022/css3-transition-for-after-pseudoelement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!