title: JavaScript move delay and multiple keystrokes
body: <p>Here is my problem: <a href="http://testepi.kvalitne.cz/test/" rel="nofollow">http://testepi.kvalitne.cz/test/</a></p>
  
  <p>I do not want the delay between a keypress and the movement of the square. I would also like to know how to move diagonally (pressing two keys at same time).</p>
  
  <p>My code: </p>
  
  <pre><code>$(function(){
  
  document.addEventListener("keydown", move, false);
  
  var x = 0;
  var y = 0;
  
  function move(event){
    if(event.keyCode==37){
          x -= 10;
    $("#square").css("left", x);
    }
  
    if(event.keyCode==39){
          x += 10;
    $("#square").css("left", x);
    }
  
    if(event.keyCode==38){
          y -= 10;
    $("#square").css("top", y);
    }
  
    if(event.keyCode==40){
          y += 10;
    $("#square").css("top", y);
    }
  
  }
  
  });
  </code></pre>