Webkit内核:
obj.addEventListener(‘webkitTransitionEnd‘,function(){},false);
firefox:
obj.addEventListener(‘transitionend‘,function(){},
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <style> .box{width:100px;height:100px;background:red;transition:1s width,2s 1s height,3s 3s background;} </style> <body> <div id="box" class="box"> </div> <script> var box = document.getElementById("box"); box.onclick= function(){ this.style.width = this.offsetWidth + 100 + "px"; } function addEnd(obj,fn){ obj.addEventListener("webkitTransitionEnd",fn,false) obj.addEventListener("transitionend",fn,false) } addEnd(box,function(){ alert("end"); }) </script> </body> </html>
false);
原文:http://www.cnblogs.com/ldmblog/p/6346711.html