11. Filling Out the Cases - "bottom" animation does not work


#1


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


Hello,
I am trying to make Mario move up by animating "bottom" parameter, but it does not work. If I change it to {up: "-=10px"}, then everything is working as it should. What am I doing wrong?

Please find the code below:

$(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({bottom: "+=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

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


#3