jQuery 11, Filling out the Cases


#1

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

If I wrap the $(“img”) in double quotes, I get the error message “Oops, try again. Did you call the .animate() function on your $(‘img’) for each of the three additional cases?”. However, if I change the double quotes to single quotes like so, $(‘img’), I pass the exercise. In both cases, the Mario sprite moves correctly

$(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

" " is absolutely fine.but i think here In codecademy system checker doesn’t allow it.


#4

Click where it says filling out the cases and click on the next exercise! YAY!!!


#5

I would have to have passed that exercise (which I did by changing to their expectations) in order for this to be useful.


#6

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