i have this simple web page and what i want to do is to fade in the first pic for 5 seconds then change it to picture # 2 for 5 seconds as well. here is my code:
<!DOCTYPE html>
<html>
<style>
#cf {
position:relative;
height:281px;
width:450px;
margin:0 auto;
}
#cf img {
position:absolute;
left:0;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
@keyframes cf3FadeInOut {
0% {
opacity:1;
}
45% {
opacity:1;
}
55% {
opacity:0;
}
100% {
opacity:0;
}
}
#cf img.top {
animation-name: cf3FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: 30s;
animation-duration: 10s;
animation-direction: alternate;
}
}
</style>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="fade.css">
<title>Wideout</title>
</head>
<body>
<iframe width="560" height="315"
src="https://www.youtube.com/embed/seMwpP0yeu4"
frameborder="0" allowfullscreen></iframe>
<div id="cf">
<img class="bottom" src="images/1.jpg" height="100" />
<img class="top" src="images/2.jpg" height="100" />
</div>
</body>
</html>
i do believe my problem is with the percentage part. can someon help me out? much appreciated
This can be done just using CSS3
Check
Here's a JSFiddle