sudo systemctl status php7.1-fpm.service
.slideshow {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 0;
list-style: none;
margin: 0;
padding: 0;
}
.slideshow li {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
opacity: 0;
z-index: 0;
animation: imageAnimation 60s linear infinite;
}
.slideshow li:nth-child(1) {
background-image: url("https://www.w3schools.com/howto/img_fjords.jpg")
}
.slideshow li:nth-child(2) {
background-image: url("https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/68dd54ca-60cf-4ef7-898b-26d7cbe48ec7/10-dithering-opt.jpg");
animation-delay: 10s;
}
.slideshow li:nth-child(3) {
background-image: url("https://cdn.pixabay.com/photo/2016/06/18/17/42/image-1465348_1280.jpg");
animation-delay: 20s;
}
.slideshow li:nth-child(4) {
background-image: url("http://eskipaper.com/images/image-2.jpg");
animation-delay: 30s;
}
@keyframes imageAnimation {
0% {
opacity: 0;
animation-timing-function: ease-in;
}
10% {
opacity: 1;
animation-timing-function: ease-out;
}
20% {
opacity: 1
}
30% {
opacity: 0
}
}
.no-cssanimations .slideshow li {
opacity: 1;
}
我附加了我的CSS和HTML代码。 5.jpeg显示后,显示一个空白页面,然后滑块重新开始重复。我想有一个连续重复的图像幻灯片,没有中断。我的代码可能有一些错误。因为我是网页设计的新手请帮帮我。 谢谢
答案 0 :(得分:0)
.slideshow li{
animation: imageAnimation 40s linear infinite;
}
如您所见,我将60s
更改为40s
,这是导致临时白色背景的原因。
<强>更新强>
我们可以看到第二个animation-delay
在10s
后开始,在20s
后第3个和30s
后第4个开始。
如果animation
中的总时间为60s
,那么对于第4个动画,事务的总持续时间为30s
,即从第30秒到第60秒。
这就是为什么你在第4张照片后得到白屏。
.slideshow {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 0;
list-style: none;
margin: 0;
padding: 0;
}
.slideshow li {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-size: cover;
background-position: 50% 50%;
background-repeat: none;
opacity: 0;
z-index: 0;
animation: imageAnimation 40s linear infinite;
}
.slideshow li:nth-child(1) {
background-image: url("https://www.w3schools.com/howto/img_fjords.jpg")
}
.slideshow li:nth-child(2) {
background-image: url("https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/68dd54ca-60cf-4ef7-898b-26d7cbe48ec7/10-dithering-opt.jpg");
animation-delay: 10s;
}
.slideshow li:nth-child(3) {
background-image: url("https://cdn.pixabay.com/photo/2016/06/18/17/42/image-1465348_1280.jpg");
animation-delay: 20s;
}
.slideshow li:nth-child(4) {
background-image: url("http://eskipaper.com/images/image-2.jpg");
animation-delay: 30s;
}
@keyframes imageAnimation {
0% {
opacity: 0;
animation-timing-function: ease-in;
}
10% {
opacity: 1;
animation-timing-function: ease-out;
}
20% {
opacity: 1
}
30% {
opacity: 0
}
}
.no-cssanimations .slideshow li {
opacity: 1;
}
&#13;
<ul class="slideshow">
<li>
<span>""</span>
</li>
<li>
<span>""</span>
</li>
<li>
<span>""</span>
</li>
<li>
<span>""</span>
</li>
</ul>
&#13;