<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<script type="text/javascript" src="./jquery-2.1.0.js"></script>
<style>
label{
cursor: pointer;
width: 30px;
height: 30px;
background-color: #ccc;
}
.show{
width: 300px;
height: 300px;
background-color: red;
display: none;
}
</style>
</head>
<body>
<label>点击我</label>
<div class="show"></div>
<script type="text/javascript">
$(document).ready(function(){
$("label").click(function(){
$(".show").slideToggle(500); //不需要任何标记,直接显示或隐藏
//slideUp() slideDown()
});
});
</script>
</body>
</html>
Js slide动画
最新推荐文章于 2022-05-21 20:14:19 发布