<script>
var swidth = $(window).width();
var sheight = $(window).height();
$(document).ready(function(){
$("#box").animate({ //animates depending on screen size
top: (sheight*0.22)+"px",
left: (swidth*0.25)+"px",
width:(swidth*0.3)-40+"px",
height: (sheight*0.35)-40+"px",
}, 2000, function(){
$('<input type="button" value="My button">').appendTo(this)
.click(function(){
$(this).animate({ // reverses animation back to original size and location
top: "150px",
left: "100px",
width:"1px",
height: "1px",
}, 2000, )
});
});
});
</script>
如果我换...
$(this).animate({ // reverses animation back to original size and location
top: "150px",
left: "100px",
width:"1px",
height: "1px",
}, 2000, )
...和...
alert("You clicked me!");
...有用。所以错误出现在某处的反向动画中。但是哪里?感谢您提前提供任何答案!