這對我的作品。並使其跨瀏覽器兼容。
基本上,我只是說相同的轉換到:hover
,但是......這是重要 ...你需要扭轉的初始transition
div {
background:red;
width:100px;
height:50px;
-moz-transition-property: height, width;
-webkit-transition-property: height, width;
transition-property: height, width;
-moz-transition-duration: 1s, 1s;
-webkit-transition-duration: 1s, 1s;
transition-property-duration: 1s, 1s;
-moz-transition-delay: 0, 1s;
-webkit-transition-delay: 0, 1s;
transition-property-delay: 0, 1s;
}
div:hover {
width:400px;
height:400px;
-moz-transition-property: width, height;
-webkit-transition-property: width, height;
transition-property: width, height;
-moz-transition-duration: 1s, 1s;
-webkit-transition-duration: 1s, 1s;
transition-property-duration: 1s, 1s;
-moz-transition-delay: 0, 1s;
-webkit-transition-delay: 0, 1s;
transition-property-delay: 0, 1s;
}
例的height
和width
:http://jsfiddle.net/qknMg/1/