我正在尝试使用CSS3自动更改背景图片。我有9个图像需要在背景中更改。我面临的问题是,它只显示幻灯片中的第一个和最后一个图像,而不是第2、3、4、5、6、7、8个。我有以下代码:
<img id="img1" src="images/1.gif">
<img id="img2" src="images/2.gif">
<img id="img3" src="images/3.gif">
<img id="img4" src="images/4.gif">
<img id="img5" src="images/5.gif">
<img id="img6" src="images/6.gif">
<img id="img7" src="images/7.gif">
<img id="img8" src="images/8.gif">
<img id="img9" src="images/9.gif">
以下是 CSS 代码:
#img1, #img2, #img3, #img4, #img5, #img6, #img7, #img8, #img9 {
width:610px;
height:610px;
position:scroll;
z-index:-1;
animation-name: test;
animation-duration: 90s;
opacity:0;
}
#img2 {
animation-delay:10s;
-webkit-animation-delay:10s
}
#img3 {
animation-delay:20s;
-webkit-animation-delay:20s
}
#img4 {
animation-delay:30s;
-webkit-animation-delay:30s
}
#img5 {
animation-delay:40s;
-webkit-animation-delay:40s
}
#img6 {
animation-delay:50s;
-webkit-animation-delay:50s
}
#img7 {
animation-delay:60s;
-webkit-animation-delay:60s
}
#img8 {
animation-delay:70s;
-webkit-animation-delay:70s
}
#img9 {
animation-delay:80s;
-webkit-animation-delay:80s
}
@-webkit-keyframes test {
0% {
opacity: 1;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
@keyframes test {
0% {
opacity: 1;
}
50% {
opacity: 1;
}
100% {
opacity: 1;
}
}
每个幻灯片的延迟时间从1到8都是10秒,除了图像9,它的延迟时间为8.60秒。
请帮我找出我的错误。:(
(n-1)*10
,意思是2=10,3=20等等。如果它们都有相同的延迟,它们将同时显示(延迟不会相加)。 - Zach Saucier