I have a question with the animation delay. I have a list of 6 images, so I would like to create a auto sliding carousel effect. So I have already make them go through the translation in CSS animation. However, the timing for the images to run is not well calculated, therefore, when looking at it, the images will overlap briefly. What I want to achieve is to make the images do not overlap and runs in a loop smoothly. I have created a fiddle.
.banner ul {
list-style: none;
margin: 0;
padding: 0;
width: 300px;
height: 200px;
display: inline-block;
position: relative;
}
.banner ul li {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
animation: coverflow 9.5s ease infinite;
}
.banner ul li:nth-child(2) {
animation-delay: 1.5s;
}
.banner ul li:nth-child(3) {
animation-delay: 3s;
}
.banner ul li:nth-child(4) {
animation-delay: 4.5s;
}
.banner ul li:nth-child(5) {
animation-delay: 6s;
}
.banner ul li:nth-child(6) {
animation-delay: 7.5s;
}
.banner ul li:nth-child(7) {
animation-delay: 9s;
}
.banner ul li img {
width: 100%;
height: 100%;
}
@keyframes
coverflow {
0%, 10% {
opacity: 1;
transform: none;
z-index: 10;
}
25%, 35% {
opacity: 0.2;
transform: translate3d(-170px, 0, 0) scale(0.6);
}
50% {
opacity: 0;
transform: translate3d(-190px, 0, 0) scale(0.6);
}
60% {
opacity: 0;
transform: translate3d(190px, 0, 0) scale(0.6);
}
75%, 85% {
opacity: 0.2;
transform: translate3d(170px, 0, 0) scale(0.6);
}
}
here is the fiddle https://jsfiddle.net/4anedqzp/2/
thanks you very much.