jQuery animate to transparent - easier solution?

后端 未结 2 917
小鲜肉
小鲜肉 2021-01-27 15:47

I want to animate background from coloured to transparent. I have code like this:

$(\'.selector\')
.animate({
        \'background-color\' : \'transparent\'
}, 2         


        
2条回答
  •  被撕碎了的回忆
    2021-01-27 16:17

    css

    .animated {-webkit-transition:background 0.4s ease;-moz-transition:background 0.5s ease;-ms-background 0.5s ease;background 0.5s ease;}
    .selector {background:red}
    .transparent_background {background: transparent};
    

    html

    js

    $(".selector").addClass("transparent_background");
    

    http://jsfiddle.net/UEyc6/

提交回复
热议问题