关键帧动画不适用于iOS的野生动物园 [英] keyframe animation does not work on safari for iOS
本文介绍了关键帧动画不适用于iOS的野生动物园的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
窗口上的所有浏览器(chrome,即Firefox,safari)都按应有的方式显示动画。当我在iPhone上尝试过该动画时,它将无法正常工作。知道为什么吗?
All the browsers (chrome, ie, firefox, safari) on windows show the animation as they should. When I have tried it on my iphone, the animation would not work. Any ideas why?
这是我的CSS:
#rotatingDiv {
position: relative;
z-index: 0;
display: block;
margin: auto;
height: 30px;
width: 30px;
-webkit-animation: rotation .7s infinite linear;
-moz-animation: rotation .7s infinite linear;
-o-animation: rotation .7s infinite linear;
animation: rotation .7s infinite linear;
border-left: 8px solid rgba(0, 0, 0, .20);
border-right: 8px solid rgba(0, 0, 0, .20);
border-bottom: 8px solid rgba(0, 0, 0, .20);
border-top: 8px solid rgba(33, 128, 192, 1);
border-radius: 100%;
}
@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
@-webkit-keyframes rotation {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(359deg);
}
}
@-moz-keyframes rotation {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(359deg);
}
}
@-o-keyframes rotation {
from {
-o-transform: rotate(0deg);
}
to {
-o-transform: rotate(359deg);
}
}
推荐答案
I到达这里时遇到了同样的问题,然后尝试了一些可行的方法:
I arrived here with the same problem, then tried something which worked :
尝试将每个关键帧(和动画)重命名为每个浏览器前缀都唯一的名称。
Try renaming each of your keyframes (and animations) to something unique for every browser prefix.
例如:
#rotatingDiv {
position: relative;
z-index: 0;
display: block;
margin: auto;
height: 30px;
width: 30px;
/* renamed these */
-webkit-animation: webkit-rotation .7s infinite linear;
-moz-animation: moz-rotation .7s infinite linear;
-o-animation: o-rotation .7s infinite linear;
animation: rotation .7s infinite linear;
border-left: 8px solid rgba(0, 0, 0, .20);
border-right: 8px solid rgba(0, 0, 0, .20);
border-bottom: 8px solid rgba(0, 0, 0, .20);
border-top: 8px solid rgba(33, 128, 192, 1);
border-radius: 100%;
}
@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
/* and renamed these accordingly */
@-webkit-keyframes webkit-rotation {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(359deg);
}
}
@-moz-keyframes moz-rotation {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(359deg);
}
}
@-o-keyframes o-rotation {
from {
-o-transform: rotate(0deg);
}
to {
-o-transform: rotate(359deg);
}
}
这篇关于关键帧动画不适用于iOS的野生动物园的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文