您好我想移动我的div当我点击一个动画效果的按钮,所以我使用。动画。但它不能正常工作 这是我使用需要移动顶部,当点击一个按钮使用动画
$(document).ready(function(){
$("#btn1").click(function(){
$("#box").animate({margin-Top: "300px"});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="btn1">Animate topdown</button>
<div id="box" style="background:#98bf21;height:100px;width:100px;margin:6px;"></div>
什么是错在我的代码我不能用顶部,而不是边距becuse我DIV位置代码:相对;
感谢。我明白 –