<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
.box {
width: 322px;
position: fixed;
bottom: 0;
right: 0;
overflow: hidden;
}
span {
position: absolute;
top: 0;
right: 0;
width: 30px;
height: 20px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="box" id="box">
<span id="closeButton"></span>
<div class="hd" id="headPart">
<img src="images/t.jpg" alt=""/>
</div>
<div class="bd" id="bottomPart">
<img src="images/b.jpg" alt=""/>
</div>
</div>
<script src="js/jquery-3.5.1.min.js"></script>
<script>
$("#closeButton").click(function(){
$("#bottomPart").animate(
{height:0},
1000,function(){
$("#box").animate({
width:0
},2000);
}
);
});
</script>
</body>
</html>
效果如下

本文介绍了一种使用HTML、CSS和jQuery实现网页元素动画效果的方法,包括固定位置盒子的缩放和高度变化。通过动画函数,实现了平滑的过渡效果。

1239

被折叠的 条评论
为什么被折叠?



