<!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動(dòng)畫特效</title>
????<script>
????????$(function(){
????????????$("body").append("<button?id='you'>右移動(dòng)50PX</button>"),
????????????$("body").append("<button?id='zuo'>左移動(dòng)50PX</button>"),
????????????$("body").append("<div>這是一段可以移動(dòng)的文字</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 回答
已采納

Caballarii
TA貢獻(xiàn)1123條經(jīng)驗(yàn) 獲得超629個(gè)贊
同時(shí)設(shè)置left和right兩個(gè)屬性是沒有用的,所以$("#zuo")的animate最好用left:"-=100px"
- 3 回答
- 0 關(guān)注
- 2370 瀏覽
添加回答
舉報(bào)
0/150
提交
取消