简体   繁体   English

在jQuery中对CSS的选择器前后进行动画处理

[英]Animating css's after and before selectors in jQuery

Is it possible to animate CSS's selectors :before and :after in jQuery's .animate() function? 是否可以在jQuery的.animate()函数中为CSS的选择器:before和:after设置动画? If not, what is the best alternative to doing that? 如果不是,那么最好的替代方法是什么?

In short no - jQuery does not support pseudo element animations or even selectors I believe. 简而言之,不-jQuery不支持伪元素动画,甚至不支持选择器。

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. 但是,您可以使用css3过渡为伪元素设置动画,但要注意,当前只有 Firefox 4.0+支持它,因此您的竞争空间非常有限。

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. 从2013年1月1日开始,Chrome支持伪元素动画/过渡。

You can find a browser support table here . 您可以在此处找到浏览器支持表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM