开发者

CSS Webkit Transition - Fade out slowly than Fade in

开发者 https://www.devze.com 2023-02-25 09:35 出处:网络
This is what I have: .box{ background:#FFF; -webkit-transition: background 0.5s; } .box:hover{ background:#000;

This is what I have:

.box{
    background:#FFF;
    -webkit-transition: background 0.5s;
}

.box:hover{
    background:#000;
}

But this appends to b开发者_JAVA百科oth onmouseover and onmouseout actions, but isn't there a way to control them? Something like:

-wekbkit-transition-IN: background 1s;
-webkit-transition-OUT: background 10s;


Just redifine your transition in the over pseudo element.

.box{
    background: white;
    -webkit-transition: background 5s;
}
.box:hover{
    background: olive;
    -webkit-transition: background 1s;
}

Look my http://jsfiddle.net/DoubleYo/nY8U8/


Either use an animation (only in webkit currently), or use JS to add and remove the properties, they will still animate.

0

精彩评论

暂无评论...
验证码 换一张
取 消