Filling Out the Cases What do I miss?


#1

this is my code but when i click submit image not move and show

The error message:

Oops, try again.
Please follow the instructions on the Full Preview page to test your code.

What do I miss?

$(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:
                // Put our code here
                $('img').animate({top: "+=10px"}, 'fast');
                break;
            // Right Arrow Pressed
            case 39:
                // Put our code here
            $('img').animate({right: "-=10px"}, 'fast');
                break;
            // Down Arrow Pressed
            case 40:
        $('img').animate({down: "+=10px"}, 'fast');
                // Put our code here
                break;
                
        }
    });
});

#4

Hi Huntongaong,

The error message:

Please follow the instructions on the Full Preview page to test your code.

There should be instructions right beside the blue Back to Editor button. You need to make sure you follow them carefully.


@amanuel2 Please include the link to your code formatting topic inside an actual answer, rather than dumping the link & leaving the topic.


#6

I fixed on you advice ,it still not work.

The error message:

Please press the required key down on [object Object].

This is mynew code

$(document).ready(function() {
$(document).keydown(function(key) {
switch(parseInt(key.which,10)) {
    case 37:
          $('img').animate({left:"-=10px"}, 'fast');
          break;
    case 38:
          $('img').animate({top:"-=10px"}, 'fast');
          break;
    case 39:
          $('img').animate({left:"+=10px"}, 'fast');
          break;
    case 40:
         $('img').animate({top:"+=10px"}, 'fast');
         break;
}
});
});

#7

@digitalblaster18360 Click on the image, then press space, then go back to the editor and you should be passed :slightly_smiling: