Result Size: 625 x 534
x
 
<!DOCTYPE html>
<html>
<head>
<style> 
#myDIV {
  width: 100px;
  height: 100px;
  background: red;
  -webkit-transition: width 2s; /* For Safari 3.1 to 6.0 */
  transition: width 2s;
}
#myDIV:hover {
  width: 400px;
}
</style>
</head>
<body>
<p>将鼠标悬停在下方的 div 元素上,等待过渡效果结束。</p>
<div id="myDIV"></div>
<p><b>注意:</b>此示例不适用于 Internet Explorer 9 和更早版本。</p>
<script>
// Code for Safari 3.1 to 6.0
document.getElementById("myDIV").addEventListener("webkitTransitionEnd", myFunction);
// 标准语法
document.getElementById("myDIV").addEventListener("transitionend", myFunction);
function myFunction() {
  this.innerHTML = "transitionend 事件发生 - 转换已经完成";
  this.style.backgroundColor = "pink";
}
</script>
</body>
</html>