【问题标题】:CSS Webkit Transition - Fade out slowly than Fade inCSS Webkit 过渡 - 淡出比淡入慢
【发布时间】:2011-08-05 19:49:03
【问题描述】:

这就是我所拥有的:

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

.box:hover{
    background:#000;
}

但这附加到 onmouseoveronmouseout 动作,但没有办法控制它们吗?比如:

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

【问题讨论】:

    标签: css webkit fade css-transitions


    【解决方案1】:

    只需在 over 伪元素中重新定义过渡。

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

    看看我的http://jsfiddle.net/DoubleYo/nY8U8/

    【讨论】:

      【解决方案2】:

      要么使用animation(目前仅在webkit中),要么使用JS添加和删除属性,它们仍然会动画。

      【讨论】:

        猜你喜欢
        • 2021-10-01
        • 2020-08-24
        • 2020-03-29
        • 2012-02-04
        • 2012-10-11
        • 1970-01-01
        • 2012-07-24
        • 2016-06-27
        • 2013-12-18
        相关资源
        最近更新 更多