• 2018.7.23 放大缩小菜单


    根据项目需求,展示隐藏侧边栏

    <html>
      <head>
        <title>最小化动画</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
      </head>
      <style>
        .wrap {
          position:relative;
          height:600px; 
        }
        .bigbox {
          400px; 
          height:600px; 
          background:gray; 
        }
        .box {
          position: absolute;
           50px;
          height: 50px;
          background: pink;
          bottom: 0;
          left: 418px;
          cursor: pointer;
        }
        button {
          float: right;
          margin-right: 16px;
          margin-top: 10px;
          cursor: pointer;
        }
        .minimum {
          -webkit-animation: change .5s ease-in-out 1 alternate forwards;
            animation: change .5s ease-in-out 1 alternate forwards;    
        }
        @-webkit-keyframes change {
          from {
            400px; 
            height:600px; 
          }
          to {
             50px;
            height: 50px;
            position: absolute;
            bottom: 0;
            left: 418px;
          }
        }
        @keyframes change {
          from {
            400px; 
            height:600px; 
            position: absolute;
            top: 0;
            left: 0;
          }
          to {
             0;
            height: 0;
            position: absolute;
            top: 0;
            left: 0;
          }
        }
        .maxmum {
          -webkit-animation: change-back .5s ease-in-out 1 alternate forwards;
            animation: change-back .5s ease-in-out 1 alternate forwards;    
        }
        @-webkit-keyframes change-back {
          from {
             50px;
            height: 50px;
            position: absolute;
            bottom: 0;
            left: 418px;
          }
          to {
            400px; 
            height:600px; 
          }
        }
        @keyframes change-back {
          from {
             0;
            height: 0;
            position: absolute;
            top: 0;
            left: 0;
          }    
          to {
            400px; 
            height:600px; 
            position: absolute;
            top: 0;
            left: 0;
          }
        }
      </style>
      <body>
          <div class="wrap">
              <div class="bigbox"> <button>最小化</button></div>    
              <div class="box"></div>
          </div>
      </body>
      <script type="text/javascript">
    
            document.getElementsByTagName("button")[0].onclick = function(){
                this.parentNode.classList.remove("maxmum");
                this.parentNode.classList.add("minimum");
            }
    
            document.getElementsByClassName("box")[0].onclick = function(){
              // document.getElementsByClassName("bigbox")[0].style.display = "block";
              document.getElementsByClassName("bigbox")[0].classList.remove("minimum");
              document.getElementsByClassName("bigbox")[0].classList.add("maxmum");
            }
          
      </script>
    </html>

    效果如下:

  • 相关阅读:
    461. Hamming Distance
    342. Power of Four
    326. Power of Three
    368. Largest Divisible Subset java solutions
    95. Unique Binary Search Trees II java solutions
    303. Range Sum Query
    160. Intersection of Two Linked Lists java solutions
    88. Merge Sorted Array java solutions
    67. Add Binary java solutions
    14. Longest Common Prefix java solutions
  • 原文地址:https://www.cnblogs.com/yuhanao/p/9354346.html
Copyright © 2020-2023  润新知