框的大小是寬度:200px,高度:140px。 使用動畫改變框大小時,它將從左上方變換。 如何更改它從中心中心轉換。jQuery〜如何從中心中心動畫框寬度和高度
的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);
});