title: addClass until keydown
body: <p>I want to add a css class (e.g. "<code>active</code>") to <code>#plane</code> until keyCode 32 (spacebar) is down (on keyUp I want to remove it).
  I guess cannot use the same logic of the movement, in this case I cannot see where should I remove the class. </p>
  
  <p><a href="http://jsfiddle.net/fbFuW/220/" rel="nofollow noreferrer">http://jsfiddle.net/fbFuW/220/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>setInterval(movePlane, 20);
  var keys = {}
  
  $(document).keydown(function(e) {
      keys[e.keyCode] = true;
  });
  
  $(document).keyup(function(e) {
      delete keys[e.keyCode];
  });
  
  
  function movePlane() {
      for (var key in keys) {
          if (!keys.hasOwnProperty(key)) continue;
          if (key == 37) {
              $("#plane").animate({left: "-=5"}, 0);                
          }
          if (key == 38) {
              $("#plane").animate({top: "-=5"}, 0);  
          }
          if (key == 39) {
              $("#plane").animate({left: "+=5"}, 0);  
          }
          if (key == 40) {
              $("#plane").animate({top: "+=5"}, 0);  
          }
          if (key == 32) {
              $("#plane").addClass("active"); //where I should remove the class?
          }
      }
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body{
  background:white;
  }
  #plane {
      height: 50px;
      position:absolute;
      top:40%;
      left:40%;
  }
  .active {
      border:10px solid red
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;img id="plane" src='http://i.imgur.com/WmhK6mX.png' border='0'/&gt;</code></pre>
  </div>
  </div>
  </p>