Keypress - 捕获键盘输入的JavaScript库
Keypress 是一个强大的 JavaScript 库,用于捕获键盘输入。这是一个有非常特殊的功能的输入捕获库,它是很容易掌握和使用,并且不依赖第三方库。在网站开发中,经常会碰到需要处理键盘输入的场景,处理起来繁琐。现在有了这个键盘输入处理的库就很方便了。
使用示例:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
keypress.combo("shift s", function() { console.log("You pressed shift and s");});// There are also a few other shortcut methods:// If we want to register a counting combokeypress.counting_combo("tab space", function(e, count) { console.log("You've pressed this " + count + " times.");});// If you want to register a sequence combokeypress.sequence_combo("up up down down left right left right b a enter", function() { lives = 30;}, true); |

浙公网安备 33010602011771号