【发布时间】:2011-11-10 00:59:54
【问题描述】:
对角线移动不起作用并在左长按/右同时发出问题
但是在双键按下时,船会发疯!
$(document).bind('keydown', function(e) {
var box = $("#plane"),
left = 37,
up = 38,
right = 39,
down = 40
if (e.keyCode == left) {
box.animate({left: "-=5000"},3000);
}
if (e.keyCode == up) {
box.animate({top: "-=5000"},3000);
}
if (e.keyCode == right) {
box.animate({left:"+=5000"},3000);
}
if (e.keyCode == down) {
box.animate({top: "+=5000"},3000);
}
});
$(document).bind('keyup', function() {
$('#plane').stop();
});
【问题讨论】:
-
+1! GRrre评论! :D 呵呵,我差点把咖啡吐了!
-
很高兴让你开心。吃完午饭回来我会试试的
-
我已经在努力了! (有时讨厌谷歌)当你吃饱了告诉我!