我有一个三个箭头的动画,使用CSS变换(scale和translateY),以及透明度向下放大和移动。在Chrome、Firefox中运行正常,但Safari只显示一个小箭头淡入淡出。请访问jsfiddle查看演示,它使用SCSS。
https://jsfiddle.net/hyanqerL/
以下是我目前在项目中使用的内容,经过了Mig的建议后进行了改进(我没有在js fiddle中包括所有的mixins。它们用于前缀)。它有所改善,但在Safari上仍然有一些错误。$base: 9.6px;
.scroll-animation {
position: absolute;
width: 100%;
height: rem(41);
bottom: rem(24);
@include flexbox;
@include justify-content(center);
&:focus {
outline: none;
}
.chevron {
position: absolute;
width: $base * 3.35;
height: $base * .3;
opacity: 0;
@include transform(scale(.3));
@include animation-name(move-chevron);
@include animation-duration(3.15s);
@include animation-timing-function(linear);
@include animation-iteration-count(infinite);
}
.chevron:first-child {
@include animation-delay(0.28s);
}
.chevron:nth-child(2) {
@include animation-delay(0.66s);
}
.chevron:before, .chevron:after {
content: '';
position: absolute;
top: 0;
height: 100%;
width: 50%;
background: white;
}
.chevron:before {
left: 0;
@include transform(skewY(30deg));
}
.chevron:after {
right: 0;
width: 50%;
@include transform(skewY(-30deg));
}
@keyframes move-chevron {
0% {
opacity: 0;
@include transform(translateY(0) scale(.3));
}
33.3% {
opacity: 1;
@include transform(translateY($base * 2.8) scale(1));
}
53.2% {
opacity: .2;
@include transform(translateY($base * 4.65) scale(0.3));
}
60.7% {
opacity: 0;
@include transform(translateY($base * 5.15) scale(0));
}
100% {
opacity: 0;
@include transform(translateY($base * 5.15) scale(0));
}
}
}
.chevron
块的transform
中添加translateY
。这很重要,否则transform
值的整个一致性将被破坏,无法正常工作。至少对我来说是这样的。 - Mig