Mario isn't moving - Filling out the cases


My code isn't working. I tried on Safari and Chrome. I even copy/pasted the exact code that is supposed to work (found on forum). Below is my code. What am i missing??
$(document).ready(function() {
$(document).keydown(function(key) {
switch(parseInt(key.which,10)) {
// Left arrow key pressed
case 37:
$('img').animate({left: "-=10px"}, 'fast');
// Up Arrow Pressed
case 38:
$('img').animate({up: "-=10px"}, 'fast');
// Right Arrow Pressed
case 39:
$('img').animate({right: "+=10px"}, 'fast');
// Down Arrow Pressed
case 40:
$('img').animate({down: "+=10px"}, 'fast');


read about properties that can be animated.
in case 40 use property top instead down.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.