【发布时间】:2013-08-15 06:57:45
【问题描述】:
我的代码中有两个div 标签。一个div 包含200 x 200 尺寸的图像。另一个div 不包含任何内容。我想将这个 200 x 200 图像动画到我的空 div 30 x 30 图像。我写了代码,但它不起作用。甚至,它在萤火虫中也没有显示任何错误。谁能帮帮我??
HTML
<div>
<img class="userimage" src="images/TF-NKWS-003.png" height="200" width="200" />
</div>
<input type="button" value="Click me to amimate" class="animationButton" />
<br><br><br><br><br><br><br><br>
<div class="addImg">
</div>
Javascript
<script type="text/javascript">
$(".animationButton").click(function(){
$(this).find(".userimage").animate({
left:$(".addImg").offset().left,
top:$(".addImg").offset().top,
width:30,
height:30
}, 1000, function(){
$(".addImg").append("<img src='images/TF-NKWS-003.png' />");
});
});
</script>
提前致谢
【问题讨论】:
标签: javascript jquery animation jquery-animate