查看演示链接jsfiddle
由于某种原因,我必须将两个效果分开两个动画,即使它在同一个目标上,但我想同时播放两个效果,我该怎么办? / p>
$(document).ready(function(){
$(".box").animate({width:10},"slow");
$(".box").animate({left:100},"slow");
});
CSS
.box {
background-color: #f00;
width:100px;
height:100px;
position:relative;
}
HTML
<div class="box" ></div>
答案 0 :(得分:2)
如果你想保持其位置,请使用margin-left
$(".box").animate({'width': '10px' , 'margin-left': '100px'},"slow");
参见演示HERE