2 Star 4 Fork 1

WFSWFS/vue3Admin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
yu.html 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
WFSWFS 提交于 2024-07-09 22:16 . 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.w{
display: block;
}
.w2{
background-color: #20a0ff;
width: 200px;
height: 200px;
margin-bottom: 50px;
animation-name: slide-in;
animation-duration: 1s;
animation-timing-function: ease-out;
animation-delay: 0s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
.w3{
background-color: #20a0ff;
width: 200px;
height: 200px;
margin-bottom: 50px;
animation-name: slide-out;
animation-duration: 1s;
animation-timing-function: ease-out;
animation-delay: 0s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
@keyframes slide-in {
0% {
opacity: 0;
transform: translateY(-30px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slide-out {
0% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(30px);
}
}
</style>
</head>
<body>
<div class="w"></div>
<button id="btn">点我</button>
</body>
<script>
let element = document.querySelector(".w");
let btn = document.getElementById("btn")
let flag = true
btn.onclick = function () {
console.log("点我")
if (flag){
element.classList.remove("w3")
element.classList.add("w2")
flag=!flag
}else{
element.classList.remove("w2")
element.classList.add("w3")
flag=!flag
}
}
</script>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/WFSWFS_admin/vue3Admin.git
git@gitee.com:WFSWFS_admin/vue3Admin.git
WFSWFS_admin
vue3Admin
vue3Admin
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385