首页 > 其他 > 详细

transition完成事件

时间:2019-07-25 00:51:02      阅读:119      评论:0      收藏:0      [点我收藏+]

技术分享图片

当transition事件完成时调用函数(移动端导航的动画消失效果)。

技术分享图片

 

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <style>
        #d1 {
            width:600px;
            height:600px;
            margin:100px auto;
            border:1px solid;
        }
        #d2 {
            width:300px;
            height:300px;
            margin:150px;
            border-radius: 150px;
            background: #ccc;
            transition-duration: 2s;
        }
    </style>
</head>
<body>
    <div id="d1">
        <div id="d2"></div>
    </div>
    <script>
        var d1 = document.getElementById("d1");
        var d2 = document.getElementById("d2");
        d1.onclick = function(){
          d2.style.width = "150px";
          d2.style.height = "150px";
          d2.style.borderRadius = "75px";
          d2.style.background = "green";
        };
        d2.addEventListener("transitionend",function(){
            d2.style.display = "none";
        })
    </script>
</body>
</html>

  

transition完成事件

原文:https://www.cnblogs.com/dayin1/p/11241637.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!