<script>
$(function(){
$("#clicky").click(function(){
$("#slide").animate({marginLeft:'500px'},'slow');
});
});
</script>
<div id="slide">
<img id="clicky" src="left.jpg" width="15" height="15" />
Div Content here...</div>
答案 0 :(得分:0)
作为第三个参数,您可以传递一个在动画结束时将被触发的函数。像这样:
$("#slide").animate({marginLeft:'500px'},'slow', function(){
$("img#clicky").attr("src", "right.jpg");
});