0

img 的 OnClick 事件:

$(obj).animate({"left": "-=40px"},"slow");
$(obj).animate({"height":"600px","width":"320px"},30);

我想为图像的宽度和高度设置动画。另外,我将图像向左移动-40px。之后再次单击事件,我想将图像恢复到原始大小和位置。我已经尝试过了,但是动画左侧正在将图像拍摄到非常左侧而不是原始位置。

$(obj).animate({"Right": "+=40px"},"slow");
$(obj).animate({"height":"449px","width":"249px","left":"-20px"},30);
4

3 回答 3

1

改变:

$(obj).animate({"height":"449px","width":"249px","left":"-20px"},30);

$(obj).animate({"height":"449px","width":"249px","left":"-=20px"},30);
于 2013-05-06T07:41:27.530 回答
1

哎呀...我注意到这"left":"-20px"是额外的

$(obj).animate({"height":"449px","width":"249px","left":"-20px"},30);

删除后问题就解决了。

于 2013-05-06T08:10:51.253 回答
0

尝试改变:

$(obj).animate({"Right": "+=40px"},"slow");

至:

$(obj).animate({"left": "+=40px"},"slow");

因为当你使用时"Right": "+=40px",你的意志再次obj向左移动40px

于 2013-05-06T07:39:05.613 回答