11/12.Filling Out The Cases - DONT WORK (27.1.16)


#1

The code is right, after many tries it was accepted & i moved on BUT only the left arrow works & not the other 3 (up, right, down) on the preview area.
1. I tried changing the case number from '37' to '38' on LINE 1.WORKS, by using another key
2. I changed the symbol from '-' to +' on LINE 2. WORKS, It goes right instead of left
3. I changed the word 'left' to 'right' on LINE 2. DOESN'T WORK.
4. I changed the word 'right' to 'left' on LINE 4. WORKS!
5. I changed the word 'up' or 'down' to 'left' on LINE 3 & 5. DOESN'T WORK.

SUMMARY: I think something is happening with the words 'up', 'down', 'right'

Please help me, because i have to figure it out to go on to the next steps.

$(document).ready(function() {
$(document).keydown(function(key) {
switch(parseInt(key.which,10)) {
// Left arrow key pressed
case 37: //LINE 1 (just comment)
$('img').animate({left: "-=10px"}, 'fast'); //LINE 2 (just comment)
break;
// Up Arrow Pressed
case 38:
$('img').animate({up: "-=10px"}, 'fast'); //LINE 3 (just comment)
break;
// Right Arrow Pressed
case 39:
$('img').animate({right: "+=10px"}, 'fast'); //LINE 4 (just comment)
break;
// Down Arrow Pressed
case 40:
$('img').animate({down: "+=10px"}, 'fast'); //LINE 5 (just comment)
break;
}
});
});


#2

Hi Sites,

The “up” and “down” keywords don't exist, and I don't think “right” exists either, but I'm not sure about that one.
You need to use left and top along with += or -= to control the direction the picture moves instead :slight_smile:


#3

You should change the hint which uses "right" in the hint example then. Also it accepts the solution when you use "up", "down", and "right".


#4

@bitpro90479 I'll try to get that done as soon as possible, thanks :slight_smile: