11. Filling Out the Cases


#1


https://www.codecademy.com/courses/web-beginner-en-JwhI1/2/3?curriculum_id=50a3fad8c7a770b5fd0007a1

My code should work. But I get error message. Should I just disregard the error message and jump to next lesson?

Tried already refreshing page and cleaning history.


$(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({top: "-=10px"}, 'fast');
				break;
			// Right Arrow Pressed
			case 39:
				$('img').animate({left: "+=10px"}, 'fast');
				break;
			// Down Arrow Pressed
			case 40:
				$('img').animate({top: "+=10px"}, 'fast');
				break;
		}
	});
});


#2

what's the error message?

try it

  • click on the Save & Submit code button
  • click on the page
  • move the object
  • now click on the Back to Editor button

#3

Code works just fine. After testing it, when I go back to editor, it shows this

Error message:

"Oops, try again. Make sure to press 'left', 'up', 'right', or 'down' to make your character move! "

ps. attached is screenshot as well


#4

so what do you think according to error message?

what lesson wants?

just think about it.I think you can do it :slight_smile:


#5

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