11. Filling Out The Cases || Approves non-functioning code


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

I filled out the code and pressed submit. It said it was correct and I could move on to the next exercise, but the animating/controlling didn't function at all. I had forgotten to add a starting '{' to my animation.

I fixed that and tried again. This time it opened a full-size preview for me to test. It worked, except I had messed up the arrows, so both up and down arrow made character go up only. It was still approved and I could continue.

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


As long as you discovered your errors and repaired them, that's the main thing. This module is very basic and the SCT not very exhaustive. Not a big deal, on the whole.


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