我正在尝试使图像变成动画并将其变大。我已经得到它来改变大小,但我现在试图做到这一点,所以没有周围的元素也不会移动。我使用jQuery来做动画,并且由于某种原因,它不会增加边距的每一步。它只在完成后才做。我以为我正确地阅读了jQuery文档。这里是我的代码到目前为止:Javascript动画图像调整大小
$(document).ready(function(){
$(".image").mouseenter(function(){
$(this).animate({height: "176px", width: "250px"},
{
step: function(now, fx) {
$(this).css("margin-left","-=0.076");
$(this).css("margin-right","-=0.084");
$(this).css("margin-bottom","-=0.152");
}
});
});
$(".image").mouseleave(function(){
$(this).animate({height: "100px", width: "174px"},
{
step: function(now, fx) {
$(this).css("margin-left","+=0.076");
$(this).css("margin-right","+=0.084");
$(this).css("margin-bottom","+=0.152");
}
});
});
});
看起来,这实际上会更容易与CSS3 ... – Connor 2012-04-23 23:15:46
好吧,我会怎么做呢?我知道CSS并不是那种更复杂的东西。 – legobear154 2012-04-23 23:17:51
我会查看:http://css3.bradshawenterprises.com/all/和http://webexpedition18.com/articles/css-animations-resources-tutorials/ – Connor 2012-04-23 23:37:11