gpt4 book ai didi

html - 图片 CSS 过渡问题

转载 作者:行者123 更新时间:2023-11-28 12:51:50 25 4
gpt4 key购买 nike

我有一个在四张图​​片之间转换的幻灯片。我让幻灯片以一定的速度播放,但最后一张幻灯片不会快速转换回第一张幻灯片。我试图添加另一个 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张图片并且你设置了

animation-delay: 12s;

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

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

animation: picTransition 56s linear infinite;

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

关于html - 图片 CSS 过渡问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16880317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com