jQuery判断动画是否执行完成
JS
$(function() { $("#myDiv").bind("click", function() { if ($(this).css("transform") == 'none') { $(this).css("transform", "scale(1.5, 1.5)"); } else { $(this).css("transform", ""); } }) $("#myDiv").on("webkitTransitionEnd msTransitionend mozTransitionend transitionend", function() { alert(1); }); });
CSS
div{
width: 100px;
height: 100px;
background:red;
transition: all 1s ease-in-out .5s;
margin: 100px auto;
}
HTML
<div id="myDiv"> </div>
CodeOpen代码: