【发布时间】:2015-12-19 03:47:22
【问题描述】:
我想创建一个有 6 帧的横幅,没有 css 样式表,并且只在 html 中使用样式标签。
我发布了第 3 次和第 4 次,因为它们是不同的并且可以看到。
我的问题是,在 Firefox 中,它在第 4(1-2-3-4-4-4) 帧上停止并且不会继续到第 5 和第 6 帧,而在 IE 中我只能看到第 1、2 和它跳到第 5 帧。
第三帧
<div style="width:1000px; height:120px;top:0px; left:0px; position:absolute; animation: frame3-animation 30s infinite ease-in;">
<img src="img/background2.jpg" style="position: absolute; top:0px; left:0px; " alt="">
<img src="img/white_background.png" style="position: absolute; top:10px; left:36px; " alt="">
<img src="img/logo2.png" style="top:7px; left:18px; position: absolute; background-position: center; background-repeat: no-repeat;" alt="">
<img src="img/frame3_cat_traiesti.png" style="position: absolute; top:20px; left:355px; " alt="">
<style>@-webkit-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
<style>@-moz-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
<style>@-oz-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
<style>@-ms-keyframes frame3-animation {
0% { opacity:1;}
48% { opacity:1;}
49% {opacity:0;}
99% {opacity:0;}
99.99999% {opacity:0;}
}</style>
这是第 4 帧。 我在动画中使用了 z-index,因为它有可点击的按钮,没有 z-index,它就无法点击
<div style="width:1000px; height:120px; top:0px; left:0px; position:absolute; animation: frame4-animation 30s infinite ease-in;">
<img src="img/background2.jpg" style="position: absolute; top:0px; left:0px; overflow: visible;" alt="">
<img src="img/white_background2.png" style="position: absolute; top:8px; left:35px; overflow: visible;" alt="">
<img src="img/frame4_cat_traiesti.png" style="position: absolute; top:30px; left:140px; overflow: visible;" alt="">
<img src="img/frame4_circle.png" style="position: absolute; top:11px; left:470px; overflow: visible;" alt="">
<img src="img/frame4_1x.png" style="position: absolute; top:17px; left:596px; overflow: visible;" alt="">
<img src="img/logo2.png" style="position: absolute; top:7px; left:18px; overflow: visible; background-position: center; background-repeat: no-repeat;" alt="">
<a href="INSERT LINK" target="_blank" style="position: absolute; top:44px; left:768px; "><img src="img/promotie.png" style="overflow: visible;" alt=""></a><!-- Insert Link-->
<style>@-webkit-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
<style>@-moz-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
<style>@-oz-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
<style>@-ms-keyframes frame4-animation {
0% {opacity:1;}
65% {opacity:1;}
66% {z-index:2;}
99% {z-index:2;}
99.99999% {z-index:2;}
}</style>
这是第 5 帧的样式(看看与第 4 帧的区别)
<style>@-webkit-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
<style>@-moz-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
<style>@-oz-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
<style>@-ms-keyframes frame5-animation {
0% { opacity:1;}
81% { opacity:1;}
82% {z-index:9;}
99% {z-index:9;}
99.99999% {z-index:9;}
}</style>
另外,我希望有更平滑的过渡。 前 3 个非常顺利,但比我想要的要慢,4-6 个是即时过渡。我想在这两者之间有一个“中间道路”。
1-3 样式过渡是一样的,4-5 可以看到,6 只是比 5 有更高的索引。
谢谢。
【问题讨论】:
-
在此处编辑您的 jsfiddles,以便其他人在遇到相同问题时可以看到它们。
标签: html css-transitions css-animations keyframe