【发布时间】:2012-04-16 23:38:51
【问题描述】:
所以我正在尝试淡化 3 张图像,其中一张慢慢叠放在一起,这样您就可以在几秒钟内看到每张图像,然后再下一张淡出顶部。我正在关注this tutorial here. 但是由于某种原因,我的图像似乎彼此褪色太快,我无法很好地控制时间。
Here is my preview page. 假设您会看到一只鸟,然后是西红柿,然后是一艘船,但现在它们只是相互重叠并最终落在船上。
我正在关注 Demo 1 和 Demo 3,你知道为什么我的动画关闭了吗?提前致谢! :)
我的 jsfiddle: http://jsfiddle.net/leongaban/TPjWG/
代码:
<style>
@-webkit-keyframes cf4FadeInOut {
0% {
opacity:0;
}
25% {
opacity:1;
}
50% {
opacity:1;
}
100% {
opacity:1;
}
}
@-moz-keyframes cf4FadeInOut {
0% {
opacity:0;
}
25% {
opacity:1;
}
50% {
opacity:1;
}
100% {
opacity:1;
}
}
@-ms-keyframes cf4FadeInOut {
0% {
opacity:0;
}
25% {
opacity:1;
}
50% {
opacity:1;
}
100% {
opacity:1;
}
}
#cf4a {
position:relative;
height:250px;
width:300px;
margin:0 auto;
}
#cf4a img {
position:absolute;
left:0;
}
#cf4a img {
-webkit-animation-name: cf4FadeInOut;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: 1;
-webkit-animation-duration: 30s;
-moz-animation-name: cf4FadeInOut;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: 1;
-moz-animation-duration: 30s;
-ms-animation-name: cf4FadeInOut;
-ms-animation-timing-function: ease-in-out;
-ms-animation-iteration-count: 1;
-ms-animation-duration: 30s;
}
#cf4a img:nth-of-type(1) {
-webkit-animation-delay: 0;
-moz-animation-delay: 0;
-ms-animation-delay: 0;
}
#cf4a img:nth-of-type(2) {
-webkit-animation-delay: 30s;
-moz-animation-delay: 30s;
-ms-animation-delay: 30s;
}
#cf4a img:nth-of-type(3) {
-webkit-animation-delay: 60s;
-moz-animation-delay: 60s;
-ms-animation-delay: 60s;
}
</style>
<div id="cf4a">
<a href="http://http://stackoverflow.com/" target="_blank"><img src="img/bird1.jpg" /></a>
<a href="http://http://stackoverflow.com/" target="_blank"><img src="img/tomato2.jpg" /></a>
<a href="http://http://stackoverflow.com/" target="_blank"><img src="img/boat3.jpg" /></a>
</div>
【问题讨论】:
标签: html css animation css-animations