【问题标题】:how do i change zindex of child div with css3 delay如何使用 css3 延迟更改子 div 的 zindex
【发布时间】:2014-03-11 11:33:53
【问题描述】:

css3 过渡延迟仅在一段时间后才开始动画。没关系。但动画只与它相关。

当鼠标悬停在子div上2s后我们可以改变它的z-index吗?

我做过的事情:

<div class="parent">
<div class="front"></div>
<div class="back"></div>
</div>

<style>
.parent:hover .front{
    transition-delay:4s;    
    /* Safari */
    -webkit-transition-delay:4s;
    z-index: -1;
}
</style>

【问题讨论】:

  • 语法应该是.parent:hover
  • 无法在 IE 10 中运行...

标签: css css-transitions delay


【解决方案1】:

此版本应适用于所有现代浏览器:http://jsfiddle.net/maximgladkov/aLEgJ/

HTML

<div class="parent">
    <div class="front"></div>
    <div class="back"></div>
</div>

CSS

.parent .front {
    z-index: 1;
}

.parent .back {
    z-index: 0;
}

.parent:hover .front {
    -webkit-transition-delay: 4s;
    -moz-transition-delay: 4s;
    -ms-transition-delay: 4s;
    -o-transition-delay: 4s;
    transition-delay: 4s; 

    z-index: -1;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-03
    • 2013-09-09
    • 1970-01-01
    • 2013-04-25
    • 2013-06-11
    • 2016-12-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多