Kibo 介绍
Kibo是 一个 简单的js类库,用来处理 键盘 事件。没有任何依赖。Kibo的构建器拥有 一个 可选选项, 一个 用来定义事件句柄的html元素。
Kibo的使用?
var k = new Kibo();
Single or multiple key combinations
k.down(['up','down'],function() {console.log('up or down arrow key pressed ');}).up('tab',function() {console.log('TAB key released');});Key combinations with modifiers
function handler() {
console.log('last key: ' + k.lastKey());
}
k.down(['shift q','ctrl alt x'],handler);
Wildcards
k.down(['any letter','any number'],function() {
console.log('letter or number key pressed ');
console.log('shift key was' + (k.lastKey('shift') ? '' : ' not') + ' pressed ');
});
k.up('any',function() {
console.log('key released');
});
Preventing the default action
k.down('f5',function() { return false; });
网站地址 : https://github.com/marquete/kibo
GitHub: https://github.com/marquete/kibo
网站描述: 一个 简单的用于处理 键盘 事件的Javascript工具库
Kibo官方网站
官方网站: https://github.com/marquete/kibo
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did174965