mmx实现图片淡入淡出_怎么用css3实现多张图片淡入淡出效果,求指点迷津!

0b6db364aef533b8decbccfd6d45490d.png

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>动画选项卡</title>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style-type: none;
}
#box {
width: 800px;
margin: 0 auto;
}
.img {
position: relative;
}
.img img {
position: absolute;
top: 0;
left: 0;
width: 800px;
height: 500px;
opacity: 0;
transition: opacity 1s;
animation: ani 15s 0s linear infinite running;
/* animation-timing-function: linear;
animation-iteration-count: infinite;
animation-duration: 15s;
animation-play-state:running; */
}
#box:hover img{animation-play-state: paused;}
/* .img a img:nth-child(1){opacity: 0;}
.img a img:nth-child(2){animation-delay: 3s;} */
/* .img a img:nth-child(3){animation-delay:7s;}
.img a img:nth-child(4){animation-delay:11s;} */
.img img.have {
opacity: 1;
z-index: 1;
}
#box .btn {
position: absolute;
left: 50%;
top: 480px;
z-index: 2;
cursor: pointer;
}
.btn li {
float: left;
width: 15px;
height: 15px;
border-radius: 50%;
background: #fff;
margin: 0 2px;
}
@keyframes ani {
0% {
opacity: 0;
z-index: 1;
}
5%{
opacity:1 ;
z-index: 1;
}
25% {
opacity: 0;
z-index: 1;
}
75%{
opacity: 0;
z-index: 0;
}
}
.btn li:after {
display: block;
content: '';
clear: both;
}
.btn li.have {
background: #f60;
}
</style>
</head>
<body>
<div id="box">
<div class="img">
<a href="http://www.baidu.com" target="blank"><img class="have" src="imgs/1.jpg" alt=""></a>
<a href="http://www.taobao.com" target="blank"><img src="imgs/2.jpg" alt=""></a>
<a href="http://www.360.cn" target="blank"><img src="imgs/3.jpg" alt=""></a>
<a href="http://www.jd.com" target="blank"><img src="imgs/4.jpg" alt=""></a>
</div>
<ul class="btn">
<li class="have"></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>

请问用css3实现多张图片淡入淡出是怎么写的,求帮忙我这样写不知道为什么只能看到一点点的变化,第一张图片都直接跳过了完全没有淡入淡出,求大神指点

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值