Ignoring delay when a key is held down?
<p>Checked out other posts, no help...</p>

<p>I'm using asdw to move an object around within a limited space.  I'm trying to figure out how to allow the object to move around while the key is pressed, without the momentary delay at the beginning.</p>

<p>Thanks...</p>

<pre><code>$(document).ready(function(){
    var longitude = 0;
    var latitude = 0;

    $('body#sense').keypress(function(){
        if(event.which == 65 || event.which == 97){
            // Left
            if(longitude != 0){
                longitude = longitude + 10;
                $('img#map').css('margin-left', longitude);
            }
        }
        else (event.which == 68 || event.which == 100){
            // Right
            if(longitude &gt; -200){
                longitude = longitude - 10;
                $('img#map').css('margin-left', longitude);
            }
        }
    });
});
</code></pre>

<p>The web page</p>

<pre><code>    &lt;body id="sense"&gt;

&lt;h2&gt;&lt;center&gt;Use your 'asdw' keys to move the map around&lt;/center&gt;&lt;/h2&gt;

&lt;div id="box"&gt;

&lt;img id="map" src="http://www.toronto.ca/culture/victoria-square/images/ch0/Victoria-Square-map-t.gif" alt="" /&gt;


&lt;/div&gt;

&lt;/body&gt;
</code></pre>

<p>The  holding the image has a set width and height, both smaller than the image.  The  is set to overflow:hidden, so the javascript moves the image around within the div so different parts are visible.</p>

<p>The CSS</p>

<pre><code>div#box {
    margin:0px auto;
    width:225px;
    height:225px;
    overflow:hidden;
}

div#box img {

}
</code></pre>
