gpt4 book ai didi

javascript - 动画中的跳跃元素

转载 作者:行者123 更新时间:2023-11-28 15:45:07 24 4
gpt4 key购买 nike

在制作汉堡菜单切换动画时,我注意到我的背景在动画播放时正在移动。任何想法可能是什么原因?

代码:

<head>
<style>
body {
background-color: #222;
height: 100vh;
}

.nav-toggle {
position: absolute;
left: 50%;
top: 50%;
}
.nav-toggle span, .nav-toggle span:before, .nav-toggle span:after {
cursor: pointer;
height: 5px;
width: 35px;
background: #fff;
position: absolute;
display: block;
content: "";
border-radius: 2px;
transition: all .5s ease-in-out;
}
.nav-toggle span:before {
top: -10px;
}
.nav-toggle span:after {
top: 10px;
}

.nav-toggle.active span {
background-color: transparent;
}

.nav-toggle.active span:before, .nav-toggle.active span:after {
top: 0;
}

.nav-toggle.active span:before {
transform: rotate(45deg);
}
.nav-toggle.active span:after {
transform: rotate(-45deg);
}
</style>
</head>
<body>
<a class="nav-toggle" href="#"><span></span></a>
</body>

http://codepen.io/rondoe/pen/BWJVpe

最佳答案

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com