小车移动实例:
<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function()
{
$("button").click(
function(){
$("#box").animate({left:'600px'},4000);//left:600px目标状态,4000时间
}
);
});
</script>
<style>
#box{
height:20px;
width:30px;
margin:0px;
position:absolute;
left:0px;
top:20px;
background:red;
}
#road{
position:absolute;
top:40px;
left:0px;
height:2px;
width:1000px;
background-color:blue;
}
button{
position:absolute;
top:50px;
}
</style>
</head>
<body>
<div id="box"></div>
<div id="road" ></div>
<button>出发</button>
</body>
</html>