【发布时间】:2013-03-25 07:19:22
【问题描述】:
我知道如何在 jQuery 中上下移动元素。
$("#div").animate({"left": "+=100"}, 1000); //move 100px to the right
但我不知道沿对角线移动。我正在下棋盘,我不知道如何有效地移动 Bishop。请查看以下网址http://chess.diem-project.org/
我确实喜欢这个……但这不是正确的方法。
for(var i = 0;i<50;i++){ // move down and move right 1 pixel at a time to get effect
$("#div").animate({"left": "+="+x}, 1);
$("#div").animate({"top": "+="+x}, 1);
}
有什么想法吗?非常感谢您的帮助!
【问题讨论】: