<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
p {
animation-name: slidein;
animation-duration: 3s;
animation-direction: reverse;
}
@keyframes slidein {
from {
margin-left: 100%;
width: 300%;
}
to {
margin-left: 0%;
width: 100%;
}
}
.box {
background-color: rebeccapurple;
border-radius: 10px;
width: 100px;
height: 100px;
}
.box:hover {
animation-name: rotate;
animation-duration: 0.7s;
animation-direction: normal;
animation-iteration-count: 10000;
}
@keyframes rotate {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
.silder{
position: absolute;
top: 30vh;
right: 0;
overflow: hidden;
box-sizing: border-box;
z-index: 100;
min-width: 50px;
height: 50px;
background-color: aquamarine;
border-radius: 10px;
}
.chunk{
float:right;
border: 1px solid red;
width: 200px;
height: 30px;
border-radius:20px;
margin-top: 10px;
margin-right:-400px;
animation-name:chunkan;
animation-duration: 4s;
animation-fill-mode: forwards;
}
.button_{
position: absolute;
right: 0rem;
width: 40px;
height: 40px;
background-color:rgb(9, 255, 0);
}
@keyframes chunkan {
0% {
margin-right:-400px;
}
100% {
margin-right: 300px;
}
}
</style>
</head>
<body>
<p>移动</p>
<div class="box"></div>
<div class="silder">
<div class="button_"></div>
<div class="chunk"></div>
</div>
</body>
</html>
菜单进入的方向可以用绝对定位来控制。设置小菜单显示宽度,就可以实现不占位的菜单收缩栏
文章来源地址https://www.toymoban.com/news/detail-416676.html
文章来源:https://www.toymoban.com/news/detail-416676.html
到了这里,关于通过css动画来驱动显示菜单面板的收缩-原理-不占位的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!