我使用不透明度为一些元素(图像和按钮)制作动画淡入淡出。它适用于所有浏览器,但在Safari上除外。当我尝试在Safari中运行它时,我的所有元素都具有100%不透明度而没有任何动画可以看到..
按钮元素的示例:
这是我的HTML:
<div id = "ctaButton" class="animate-fadeButton">
</div>
我的CSS:
#ctaButton{
position:absolute;
margin: auto;
left: 26%;
top:70%;
padding:10px; background: #CCC;
background-color: rgba(255,131,15,0.5);
}
@keyframes fadeButton {
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
animation-timing-function: linear;
}
@-o-keyframes fadeButton{
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
animation-timing-function: linear;
}
@-moz-keyframes fadeButton{
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
animation-timing-function: linear;
}
@-webkit-keyframes fadeButton{
0% { opacity:0; }
25% { opacity:0; }
35% { opacity:1; }
90% { opacity:1; }
100% { opacity:0; }
-webkit-animation-timing-function: linear;
}
.animate-fadeButton {
-webkit-animation: fadeButton 15s infinite;
-moz-animation: fadeButton 15s infinite;
-o-animation: fadeButton 15s infinite;
animation: fadeButton 15s infinite;
}
答案 0 :(得分:1)
您需要在关键帧动画之前设置动画名称和时间,而不是在
之后<强> CSS 强>
enumerate