How to make a simple timer image slideshow using HTML and CSS -
i'm trying make simple timer slideshow. image visible amount of seconds (lets 5) , switches image, , repeats. i've searched can't seem work me. amazing
here's tried far. tried 2 images fading in, thing not overlap. 1 above other, , fading animation works, both fade @ exact same time, instead of 1 fading image.
<style> @keyframes cf3fadeinout { 0% {opacity:1;} 45% {opacity:1;} 55% {opacity:0;} 100% {opacity:0;} } #cf { animation-name: cf3fadeinout; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-duration: 10s; animation-direction: alternate; } </style> <div id="cf"> <img class="bottom" src="12289696_1526730367649084_3157113004361281453_n.jpg" /> <img class="top" src="11406788_1433347623654026_6824927253890240539_n.jpg" /> </div>
with 2 image , can @ low cost css animation:
@keyframes cf { 50% {/* @ 50%, avoids alternate mode */ opacity: 0; } } #cf {/* same size image */ height: 300px; width: 200px; margin:auto; } #cf img { position: absolute;/* lets stack them */ } #cf .top { animation: cf 10s infinite; /* let run ever */ }
<div id="cf"> <img class="bottom" src="http://lorempixel.com/200/300/people/3" /> <img class="top" src="http://lorempixel.com/200/300/people/4" /> </div>
Comments
Post a Comment