0

我有一张在四张照片之间转换的幻灯片。我让幻灯片以一定的速度运行,但最后一张幻灯片并没有快速过渡到第一张幻灯片。我试图添加另一个 nth 并且我试图减慢最后 nth 的速度,但它不起作用。我希望整张幻灯片在某个时间过渡,但最后一张幻灯片需要回到第一张幻灯片,而不会出现巨大的黑色延迟。这是代码:

    .picTransition .item {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0;
  -webkit-animation: picTransition 56s linear infinite;
  -moz-animation: picTransition 56s linear infinite;
  -ms-animation: picTransition 56s linear infinite;
  animation: picTransition 56s linear infinite;
}
.picTransition .item:nth-child(2) {
  -webkit-animation-delay: 12s;
  -moz-animation-delay: 12s;
  -ms-animation-delay: 12s;
  animation-delay: 12s;
}
.picTransition .item:nth-child(3) {
  -webkit-animation-delay: 24s;
  -moz-animation-delay: 24s;
  -ms-animation-delay: 24s;
  animation-delay: 24s;
}
.picTransition .item:nth-child(4) {
  -webkit-animation-delay: 36s;
  -moz-animation-delay: 36s;
  -ms-animation-delay: 36s;
  animation-delay: 36s;
}

@-webkit-keyframes picTransition {
    0%, 25%, 100% { opacity: 0; }
    4.17%, 20.84% { opacity: 1;}
}
@-moz-keyframes picTransition {
    0%, 25%, 100% { opacity: 0; }
    4.17%, 20.84% { opacity: 1;}
}
@-ms-keyframes picTransition {
    0%, 25%, 100% { opacity: 0; }
    4.17%, 20.84% { opacity: 1;}
}
@keyframes picTransition {
    0%, 25%, 100% { opacity: 0; }
    4.17%, 20.84% { opacity: 1;}
}

我在这里做错了什么?

4

1 回答 1

0

如果你有 4 张图像并且你设置

animation-delay: 12s;

对于每一个,循环时间为 4 * 12 = 48s。

相反,您的循环时间为 56 秒

animation: picTransition 56s linear infinite;

这意味着结束时有 8 秒的间隔

于 2013-06-02T11:06:06.543 回答