demo.html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .box { height: 300px; width: 300px; border: 1px solid #000; transition: all 1s; } </style> </head> <body> <div class="box"></div> <script> window.onload = function() { var box = document.querySelector(".box"); box.onclick = function() { this.style.backgroundColor = "red"; } // 过渡(动画)结束事件(CSS3的新属性,要加上浏览器前缀webkit) box.addEventListener("webkitTransitionEnd",function() { this.style.borderRadius = "50px"; }); } </script> </body> </html>
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。