<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<title>jQuery动画特效</title>
<script>
$(function(){
$("body").append("<button id='you'>右移动50PX</button>"),
$("body").append("<button id='zuo'>左移动50PX</button>"),
$("body").append("<div>这是一段可以移动的文字</div>")
$("div").css({"background-color":"red","color":"white","width":"300","height":"80","position":"absolute"});
$("#you").bind("click",function(){$("div").animate({left: "+=100px"},2000,function(){})});
$("#zuo").bind("click",function(){$("div").animate({right: "+=100px"},2000,function(){})});
});
</script>
</head>
<body>
</body>
</html>
- 3 回答
- 0 关注
- 2317 浏览
添加回答
举报
0/150
提交
取消