亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么可以左移,右移卻不行啊,檢查半天沒發現代碼不妥啊。

<script type="text/javascript">
??????? $(function(){
??????????? $("#b1").bind("click",function(){
??????????????? $("h1").html("move left");
??????????????? $("div").animate({
??????????????????? left:"-=50px"
??????????????? },1500,function(){
??????????????????? $("h1").html("finish.");
??????????????? });
???????????????
??????????? });
??????????? $("#b2").bind("click",function(){
??????????????? $("h1").html("move right");
??????????????? $("div").animate({
??????????????????? left:"+=50px"
??????????????? },1500,function(){
??????????????????? $("h1").html("finish.")
??????????????? });
??????????? });
??????? });
??? </script>

正在回答

2 回答

<style type="text/css">
??????????????? .div1{
??????????????????? position:relative;
??????????????? width:100px;
??????????????? height:100px;
??????????????? border: solid 2px black;
??????????????? background-color: purple;
??????????????? color:White;
??????????????? margin:20px auto;
??????????????? margin-left:60px;
??????????????????? }
??????????? </style>??

0 回復 有任何疑惑可以回復我~

我試了一下可以的,div的css是不是有問題?

我的div的css是這樣的

<style type="text/css">

div{

position:absolute;

background-color:red;

width:20px;

height:20px;

left:50%;

right:50%;

}

</style>


0 回復 有任何疑惑可以回復我~
#1

仔仔se7en 提問者

.div1{ position:relative; width:100px; height:100px; border: solid 2px black; background-color: purple; color:White; margin:20px auto; margin-left:60px;
2016-07-18 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
jQuery基礎課程
  • 參與學習       154733    人
  • 解答問題       7289    個

加入課程學習,有效提高前端開發速度

進入課程

為什么可以左移,右移卻不行啊,檢查半天沒發現代碼不妥啊。

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號