【发布时间】:2019-12-04 05:22:48
【问题描述】:
我有一个放大和向下移动的三个箭头的动画,除了不透明度外,还使用 CSS 变换(缩放和 translateY)。它在 Chrome、Firefox 中运行良好。但 Safari 只显示一个淡入淡出的小箭头。请访问 jsfiddle 获取使用 SCSS 的演示。
https://jsfiddle.net/hyanqerL/
以下是我现在在我的项目中使用的,在使用了 Mig 的建议之后(我没有在 js fiddle 中包含所有的 mixin。它们用于前缀)。它有所改进,但在 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));
}
}
}
【问题讨论】:
-
不确定它是仅在您的 sn-p 中还是在实际代码中,但您忘记在默认
.chevron块的transform中添加translateY。这很重要,否则transform值的整体一致性将被破坏,无法正常工作。至少对我有用。
标签: css animation safari transform