盒子大小为宽度:200px,高度:140px。
使用animate来改变盒子大小时,它会从左上角进行变换。
如何使它从中心点进行变换。
Html
<div class="box"></div>
CSS
width:200px;
height:140px;
background-color:#0066CC;
jQuery
$('.box').mouseover(function() {
$(this).animate({
width: "210px",
height: "150px"
}, 200 );
});
$('.box').mouseout(function() {
$(this).animate({
width: "200px",
height: "140px"
}, 200 );
});