【发布时间】:2017-11-03 06:47:50
【问题描述】:
我创建了这种情况的模型,因为我无法如此轻松地创建可测试的版本。但要了解要点:
@keyframes mainFadeIn {
0% {
opacity: 0;
transform: translateY(-3rem);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
// If I use this, without the transform, then everything works.
//
// @keyframes mainFadeIn {
// 0% {
// opacity: 0;
// }
//
// 100% {
// opacity: 1;
// }
// }
.main {
animation-name: mainFadeIn;
animation-duration: 1s;
animation-fill-mode: both;
animation-timing-function: linear;
background-color: gray;
width: 100%;
height: 16rem;
padding: 3rem;
}
.card {
transition: transform 500ms;
transform-style: preserve-3d;
-webkit-transform-origin: 50% 50%;
perspective: 200px; // Ignore
margin: auto;
width: 30rem;
height: 10rem;
background-color: lightblue;
&.flipped {
transform: rotateY(-180deg);
}
}
.front,
.back {
backface-visibility: hidden;
}
.back {
transform: rotateY(-180deg);
}
<div class="main">
<div class="card">
<div class="front"></div>
<div class="back"></div>
</div>
</div>
希望这足以知道问题出在哪里。
代码笔: https://codepen.io/anon/pen/owvqQP/
编辑 好吧。大概就是这个东西:css z-index lost after webkit transform translate3d
但我仍然无法让它工作。唯一的解决方案是使用 position: relative; 和 top: 0; 和 top: -3rem; 动画..
【问题讨论】:
-
你的 ios safari 版本是多少?
-
iOS 9.2.1 是操作系统版本。