我想让下面所有的img都具有动画效果
<img class="image" width="1" src="/assets/vote.gif" alt="option">
<img class="image" width="1" src="/assets/vote.gif" alt="option">
<img class="image" width="1" src="/assets/vote.gif" alt="option">
<img class="image" width="1" src="/assets/vote.gif" alt="option">我想用jQuery.animate设置不同宽度的img。
怎么做?
发布于 2011-10-21 20:58:07
上述答案的延伸
var width = 100;
$("img").each(function() {
$(this).animate({"width": height+"px"}, 1000);
width += 100;
});发布于 2011-10-21 20:24:41
您忘记了用$()包装this
$("img").each(function() {
$(this).animate({"width": "100px"}, 1000);
})顺便说一句,你可以做得更简单:
$("img").animate({"width": "100px"}, 1000);https://stackoverflow.com/questions/7849284
复制相似问题