我有这个简单的网页,我想做的是淡入第一张图片 5 秒,然后将其更改为图片 #2 5 秒。这是我的代码:
<!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>
我确实相信我的问题在于百分比部分。有人可以帮我吗?非常感激