有没有开放源代码库JS在浏览器中的键盘绑定? [英] Is there an open source library JS for keyboard binding in the browser?

查看:139
本文介绍了有没有开放源代码库JS在浏览器中的键盘绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要创建一个基于键盘快捷键的JavaScript应用程序,这里是一个开源库,通过跨浏览器支持和一个简单的Api来满足这些需求?

I am looking to create a JavaScript app that relies heavily on keyboard shortcuts, is here a open-source library that answers those needs with cross-browser support and an easy Api?

推荐答案

KeyMaster


一个简单的微库,用于定义和调度键盘
快捷键。它没有依赖关系。

A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.



// define short of 'a'
key('a', function(){ alert('you pressed a!') });

// returning false stops the event and prevents default browser events
key('ctrl+r', function(){ alert('stopped reload!'); return false });

// multiple shortcuts that do the same thing
key('⌘+r, ctrl+r', function(){ });

这篇关于有没有开放源代码库JS在浏览器中的键盘绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆