条件函数

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
@keyframes swiper {
0%{transform: translateX(0)}
28%{transform: translateX(0)}
33%{transform: translateX(-300px)}
61%{transform: translateX(-300px)}
66%{transform: translateX(-600px)}
95%{transform: translateX(-600px)}
100%{transform: translateX(-900px)}
}
#box{width: 300px;height: 200px;border: 2px solid;overflow: hidden}
#box>div>div{width: 300px;height: 200px;font-size: 50px;text-align: center;line-height: 200px;float: left}
#box>div{width: 9999px;height: 200px;animation: swiper 10s linear infinite}

#btn{width: 50px;height: 20px;position: relative}
#btn>button{width: 50px;height: 20px;background: #4e6ef2}
#btn>div{width: 0;height: 20px;background: rgba(255,255,255,.7);position: absolute;left: 0;top: 0;transition: width .3s linear}
#btn:hover>div{width: 100%}
</style>
</head>
<body>
<div id="box">
<div>
<div style="background: #00b38a">1</div>
<div style="background: #130606">2</div>
<div style="background: #4e6ef2">3</div>
<div style="background: #00b38a">1</div>
</div>

</div>
<div id="btn">
<button>more</button>
<div></div>
</div>
</body>
</html>
posted @ 2023-06-30 10:39  崔鑫焱  阅读(89)  评论(0)    收藏  举报