为了获得更好的结果,您必须使用这样的 CSS 属性:
#container{
overflow:hidden;
width:489px;
height:178px;
position:relative;
}
#container img{
position:relative;
margin:auto;
-webkit-transition: all 4s ease-out;
-moz-transition: all 4s ease-out;
-o-transition: all 4s ease-out;
transition: all 4s ease-out;
}
#container img.zoom {
-moz-transform: scale(2);
-webkit-transform: scale(2);
-o-transform: scale(2);
transform: scale(2);
-ms-transform: scale(2);
filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand',
M11=2, M12=-0, M21=0, M22=2);
}
和 javascript:
$().ready(function(){
$('img').addClass('zoom');
});
添加缩放类时,图像会在 4 秒内缩放到 2。
查看完整演示:http: //jsfiddle.net/rNY6T/18/