亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

一個css3動畫

一個css3動畫

偶然的你 2018-08-20 19:19:13
我想點擊這個按鈕時,讓這個按鈕四周有一片淡淡的波紋向外擴散,這個好做嗎?像這樣:
查看完整描述

2 回答

?
三國紛爭

TA貢獻1804條經驗 獲得超7個贊

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title></title>

        <style>

            .wave{

               background: #FC7171;

               color: white;

               width: 200px;

               height: 200px;

               border-radius: 50%;

               border:none;

               outline: none;

               position: relative;              

            }

        .wave p{

            position: absolute;

            z-index: 7;

            text-align: center;

             display: block;

        }

            

        .animat::before,.animat::after{

          content:"";

          position:absolute;

         background: #FA7C7C;

          background-position:center center;

          border-radius:50%;         

        }

        .animat::before{

          z-index:2;

          animation:wave 2s ease-out infinite;

          -webkit-animation:wave 2s ease-out infinite;

        }

        .animat::after{

          z-index:3;

          animation:wave 2s ease-out .2s infinite;

          -webkit-animation:wave 2s ease-out .2s infinite;

        }

        @keyframes wave{

          0%{

            top: 50%;left: 50%;

            transform: translate(-50%, -50%) scale(1.4);

            width:30px;

            height:30px;

            opacity: 1;

          }

          50%{

            top: 50%;left: 50%;

            transform: translate(-50%, -50%) scale(1);

            width:240px;

            height:240px;

          }

          100%{

            top: 50%;left: 50%;

            transform: translate(-50%, -50%) scale(1);

            width:240px;

            height:240px;

            opacity: 0;

          }

        }

 

      

        </style>

    </head>

    <body>

        <button class="wave"><p>點擊計數</p></button>

        <script>

            var btn = document.getElementsByTagName("button")[0];

            var timer;

            btn.onclick = function(){                    

                this.classList.add("animat");

                    if(timer){

                        clearInterval(timer);

                    }

                timer = setTimeout(function(){

                    this.classList.remove("animat");

                }.bind(this),2000);

            }

        </script>

    </body>

</html>


查看完整回答
反對 回復 2018-09-02
  • 2 回答
  • 0 關注
  • 809 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號