jQuery mario expertise the number of case


#1

why can't i work this exercise if i change the number of case ?
$(document).ready(function() {
$(document).keydown(function(key) {
switch(parseInt(key.which,10)) {
// Left arrow key pressed
case 1://a
$('img').animate({left: "-=20px"}, 'fast');
break;
// Up Arrow Pressed
case 2:
// Put our code here
$('img').animate({top: "+=10px"}, 'fast');
break;
// Right Arrow Pressed
case 3:
// Put our code here
$('img').animate({top: "-=20px"},'fast');

			break;
		// Down Arrow Pressed
		case 4:
			// Put our code here
			$('img').animate({left: "+=10px"},'fast');

			break;
			default:
			break;

	}
});

});


#2

Hi 石善元,

You're checking for when they press a apparently, but the keycode for a isn't 1, it's 65. If you use a keycode finder, like this one, and use the correct keycodes, I think your code will work :)