关于JQUERY图形移动
#box
{
width:50px;
height:50px;
background-color:Red;
position:relative; 此处不可省
HTML 元素默认是静态定位,且无法移动。
如需使元素可以移动,请把 CSS 的 position 设置为 relative 或 absolute。
}
<script type="text/javascript">
$(document).ready(function () {
$(".001").click(function () {
$("#box").animate({ left: "500px" }, 5000); $("#box").animate({ top: "400px" }, "slow"); $("#box").animate({ left: "100px" }, "slow");
$("#box").animate({ top: "0px" }, "slow"); $("#box").animate({ left: "0px" }, "slow");
});
});
</script>
<button type="button" class="001">
001</button>
<div id="box">跟我走呀</div>