Animating css's after and before selectors in jQuery

落爺英雄遲暮 提交于 2019-12-13 16:07:38

问题


Is it possible to animate CSS's selectors :before and :after in jQuery's .animate() function? If not, what is the best alternative to doing that?


回答1:


In short no - jQuery does not support pseudo element animations or even selectors I believe.

You can however animate pseudo elements using css3 transitions but it is to note that only Firefox 4.0+ supports it currently, so your playing field is very limited.

If it's that important, just create new child elements in the element you want to animate them.

Update

Pseudo element animations/transitions are now supported in Chrome as of January 1st, 2013.

You can find a browser support table here.



来源:https://stackoverflow.com/questions/14109964/animating-csss-after-and-before-selectors-in-jquery

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