Mario can only move left


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/web-beginner-en-JwhI1/2/3?curriculum_id=50a3fad8c7a770b5fd0007a1#

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
mario will only move left, not right, down, or up.

```

$(document).ready(function() {
$(document).keydown(function(key) {
switch(parseInt(key.which,10)) {
// Left arrow key pressed
case 37:
$(‘img’).animate({left: “-=10px”}, ‘fast’);
break;
// Up Arrow Pressed
case 38:
$(‘img’).animate({up: “-=10px”}, ‘fast’);
break;
// Right Arrow Pressed
case 39:
$(‘img’).animate({right: “-=10px”}, ‘fast’);
break;
// Down Arrow Pressed
case 40:
$(‘img’).animate({down: “-=10px”}, ‘fast’);
break;
}
});
});

<do not remove the three backticks above>

#2

If you look into your CSS-file
you will see

img {
    position: relative;
    left: 0;
    top: 0;
}

Loading the HTML-file
will put your image in the =left= =top= corner.

So the only valid animations would be

top: "+=10px"
top: "-=10px"
left: "+10px"
left: "-10px"

#3

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