<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../js/jquery-2.2.3.min.js"></script>
<style type="text/css">
#ani1{
position:absolute;
left:100px;
background-color:red;
}
</style>
<title>动画练习</title>
</head>
<body>
<input id="btn1" type="button" value="左移"/>
<input id="btn2" type="button" value="右移"/>
<div id="ani1">移动</div></br>
<span></span>
<script type="text/javascript">
$("#btn1").bind("click",function(){
$("#ani1").animate({left:"-=50px"},"slow",$("span").html("执行左移完成"));
});
$("#btn2").bind("click",function(){
$("#ani1").animate({left:"+=50px"},"slow",$("span").html("执行右移完成"));
});
</script>
</body>
</html>
看看哪里有问题啊?执行不了动画
相关分类