jQuery_360开关机动画/自己实现

知识点

  1. 自定义动画

代码部分

<!--@description-->
<!--@author beyondx-->
<!--@date Created in 2022/08/01/ 20:27-->
<!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>

</body>
</html>
<script src="jquery-1.12.4.js"></script>
<script>
  $(function () {
      $('#closeButton').click(function () {
          $('#bottomPart').animate({
                height: 0,
              }, 2000, 'linear', function () {
              $('#box').animate({
                  width: 0,
              }, 2000, 'linear');
          });
      });
  });
</script>

posted on 2022-08-01 20:45  beyondx  阅读(105)  评论(0编辑  收藏  举报

导航