11. Filling Out the Cases


#1

So as you can see below, the .animate() function has been used and the code works, but I can't continue.
Could someone tell me how to fix that? I already refreshed the page and changed browser :confused: .


#2

@kuronekamixiii,
Could you provide the FULL code as ASCII


#3

Sorry but I don't understand what you mean. How do you want the full code in ASCII? The code I needed to do is in "script.js".

Thanks for replying though.


#4

@kuronekamixiii,
You select that code in script.js
make a copy with CTRL-c
and paste this copied code into the Post with CTRL-v.....


#5

My bad, didn't know what the ASCII meant.

$(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;
}
});
});


#6

@kuronekamixiii,
The course checker is looking for single-quoted-' coding
Try it with

$(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;
	}
	});
});

You will be asked to use the arrow-down, but first you have to click in the screen.....


#7

Thank you, Leon. As ever, your comments are very helpful and that recommendation did the trick. The course checker wanted a single quoted code, indeed.


#8

Thanks man, But why wont double quotes work in this case, It worked in the cases before
whats the big difference here


#9

A post was split to a new topic: Filling out classes - 11