I am making a slideshow using just html and css in which images fade into one another on an infinite loop.
However, when I test it. The first image fades completely to white and then the second image fades in, rather than the first image fading out and the second image in at the same time.
To clarify, this only occurs from the second cycle onwards. That is, the first cycle of five images does transition seamlessly, with simultaneous fade-ins and fade-outs, but every other subsequent cycle of the slideshow has whiteouts between slides.
I would like to make these transitions seamless. Obviously, I have made a mistake with either my opacity controls or the key frames timer.
Please help. Very grateful.
The CSS:
.css-slideshow { min-width:100%; position: fixed; } .css-slideshow figure { position: fixed; min-width: 100%; width: 100%; margin: 0 auto; } figure:nth-child(1) { animation: xfade 24s 24s infinite; } figure:nth-child(2) { animation: xfade 24s 18s infinite; } figure:nth-child(3) { animation: xfade 24s 12s infinite; } figure:nth-child(4) { animation: xfade 24s 6s infinite; } figure:nth-child(5) { animation: xfade 24s 0s infinite; } @keyframes xfade { 0%{ opacity: 1; } 10.5% { opacity: 1; } 12.5%{ opacity: 0; } 98% { opacity: 0; } 100% { opacity: 1; } } The HTML:
<div class="css-slideshow"> <figure> <img src="slider-image1.jpg" width="100%" alt="class-header-css3"/> </figure> <figure> <img src="slider-image2.jpg" width="100%" alt="class-header-semantics"/> </figure> <figure> <img src="slider-image3.jpg" width="100%" alt="class-header-offline"/> </figure> <figure> <img src="slider-image4.jpg" width="100%" alt="class-header-device"/> </figure> <figure> <img src="dfdfdfdfdd.jpg" width="100%" alt="class-header-connectivity"/> </figure> </div>