How to animate :before selector with jQuery

随声附和 提交于 2019-12-31 03:12:12

问题


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
        });
    }
});

回答1:


If you use http://jquery.lukelutman.com/plugins/pseudo/jquery.pseudo.js

When you do this, it will work:

pilot_shadow = $('#remote_control:before');


来源:https://stackoverflow.com/questions/14398266/how-to-animate-before-selector-with-jquery

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