如何动画:用jQuery选择前 [英] How to animate :before selector with jQuery
本文介绍了如何动画:用jQuery选择前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些元素:before伪选择器中定义。我需要添加它的一些过渡,动画,但在CSS中这是不可能的。所以,我认为我可以用jQuery做到这一点,但事情也不是工作的权利。你可以帮我吗?这是我的code:
VAR试点= $('#遥控玩具),
pilot_shadow = $('#遥控玩具:前');
pilot.on({
的mouseenter:功能(){
pilot_shadow.animate({
不透明度:0
});
}
});
解决方案
如果您使用的 http://jquery.lukelutman.com/plugins/pseudo/jquery.pseudo.js
当你做到这一点,将工作:
pilot_shadow = $('#遥控玩具:前');
I have some element with :before pseudo selector define. I need to add some transition, animation for it but in CSS it's not possible. So i think that i can do this with jQuery but something is nor working right. Can you help me? This is my code:
var pilot = $('#remote_control'),
pilot_shadow = $('#remote_control:before');
pilot.on({
mouseenter: function(){
pilot_shadow.animate({
opacity: 0
});
}
});
解决方案
If you use http://jquery.lukelutman.com/plugins/pseudo/jquery.pseudo.js
When you do this, it will work:
pilot_shadow = $('#remote_control:before');
这篇关于如何动画:用jQuery选择前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文