在jQuery中对CSS的选择器前后进行动画处理 [英] Animating css's after and before selectors in jQuery

查看:74
本文介绍了在jQuery中对CSS的选择器前后进行动画处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在jQuery的.animate()函数中为CSS的选择器:before和:after设置动画?如果没有,那么最好的替代方法是什么?

解决方案

总之,不-jQuery不支持伪元素动画,甚至不支持选择器.

不过,您可以使用css3过渡为伪元素设置动画,但是要注意,目前只有 Firefox 4.0+支持它,因此您的竞争空间非常有限.

如果这很重要,只需在要为其设置动画的元素中创建新的子元素.

更新

自2013年1月1日起,Chrome已支持伪元素动画/过渡 ./p>

您可以在此处.

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?

解决方案

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.

这篇关于在jQuery中对CSS的选择器前后进行动画处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆