Jquery 11 filling out the cases


Maybe I am missing something would love some help

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

I thought I had everything correct, but when i go the page and click to arrows its only moves left and up. Not sure what is wrong.


Aniimation is relative to the top and left axes.

top: "-=10px"   => up
top: "+=10px"   => down

left: "-=10px"  => left
left: "+=10px"  => right


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