Keypress 是一个强大的 JavaScript 库,用于捕获键盘输入。这是一个有非常特殊的功能的输入捕获库,它是很容易掌握和使用,并且不依赖第三方库。在网站开发中,经常会碰到需要处理键盘输入的场景,处理起来繁琐。现在有了这个键盘输入处理的库就很方便了。
使用示例:
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 combo
keypress.counting_combo(
"tab space"
(e, count) {
"You‘ve pressed this "
+ count +
" times."
// If you want to register a sequence combo
keypress.sequence_combo(
"up up down down left right left right b a enter"
lives = 30;
},
true
立即下载 效果演示
Keypress - 捕获键盘输入的JavaScript库,布布扣,bubuko.com
Keypress - 捕获键盘输入的JavaScript库
原文:http://www.cnblogs.com/xiaochao12345/p/3730049.html