开发者

keydown() and holding in a key

$(document).keydown(myOnKeyDownFunction);

开发者_StackOverflowI notice that in Chrome 10.0 and Firefox 3.6 (both in Ubuntu), after registering a listener for keydown, the callback is invoked once immediately, followed by a short delay, and then triggered again repeatedly until the key is released. For my current project, this sure makes my life easier... but can I expect it to behave like that for all browsers?


There's a (possibly out-of-date) summary of how various browsers handle key presses and keyboard auto-repeat at http://unixpapa.com/js/key.html


It should be the same for all browsers since this event should mirror the keyboards repeat buffer.

Try to put your cursor in any text field and look how the flow of letters are when you just hold down a key - it is exactly like your describe.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜