About
jQuery Hotkeys is a plug-in that lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination.
This plugin is based off of the plugin by Tzury Bar Yochay: jQuery.hotkeys
The syntax is as follows:
$(expression).bind(types, keys, handler); $(expression).unbind(types, handler); $(document).bind('keydown', 'ctrl+a', fn); // e.g. replace '$' sign with 'EUR' $('input.foo').bind('keyup', '$', function(){ this.value = this.value.replace('$', 'EUR'); });
Syntax when wanting to use jQuery's on()
/off
methods:
$(expression).on(types, null, keys, handler); $(expression).off(types, handler); $(document).on('keydown', null, 'ctrl+a', fn); // e.g. replace '$' sign with 'EUR' $('input.foo').on('keyup', null, '$', function(){ this.value = this.value.replace('$', 'EUR'); });
Types
Supported types are 'keydown'
, 'keyup'
and 'keypress'
Notes
If you want to use more than one modifiers (e.g. alt+ctrl+z) you should define them by an alphabetical order e.g. alt+ctrl+shift
Hotkeys aren't tracked if you're inside of an input element (unless you explicitly bind the hotkey directly to the input). This helps to avoid conflict with normal user typing.
jQuery Compatibility
Works with jQuery 1.4.2 and newer.
It known to be working with all the major browsers on all available platforms (Win/Mac/Linux)
- IE 6/7/8
- FF 1.5/2/3
- Opera-9
- Safari-3
- Chrome-0.2
Addendum
Firefox is the most liberal one in the manner of letting you capture all short-cuts even those that are built-in in the browser such as Ctrl-t
for new tab, or Ctrl-a
for selecting all text. You can always bubble them up to the browser by returning true
in your handler.
Others, (IE) either let you handle built-in short-cuts, but will add their functionality after your code has executed. Or (Opera/Safari) will not pass those events to the DOM at all.
So, if you bind Ctrl-Q
or Alt-F4
and your Safari/Opera window is closed don't be surprised.
来源:https://github.com/jeresig/jquery.hotkeys
相关推荐
jquery_hotkeys.zip,就是网页是监听用户按键要用到的jquery库
热键工具Hotkeys源码 热键工具Hotkeys源码
jquery.hotkeys插件键盘按键监听事件代码
这是一款基于jquery.hotkeys插件实现的支持多复合键键盘按键监听事件代码,页面响应键盘按钮提示代码。
使用这个js脚本可以很方便的实现和检测键盘的组合键,特别适用于开发游戏的键盘输入。
jquery.hotkeys键盘事件处理插件DEMo
jquery.hotkeys就是网页是监听用户按键要用到的jquery库,这里简单介绍下使用方法,需要的朋友可以参考下
jQuery键盘按键监听提示代码是一款基于jquery.hotkeys插件实现的支持多复合键键盘监听事件特效。
#jQuery 热键库允许您使用 jquery 实现快捷键行为。 有时,当应用程序具有许多特性和功能时,需要在页面上实现例如帮助指南。 最简单的方法是在页面上添加图标,当然也可以添加显示帮助指南的快捷方式“f1”。 < ...
react-hotkeys, 声明式热键和焦点区域管理 热键 用于在响应应用程序中处理热键和焦点区域的声明性库。功能概述最小和声明性 API易于定制的命名热键由于捕鼠,直观的按键命令基于树的优先权- 最专注的处理器获胜请...
John Resig 的 jquery.hotkeys 插件的角度指令改编。 #Requirements# 它需要 jquery.hotkeys 存在,你可以从: : 下载 #Usage# 首先将js 添加到页面(确保存在jquery.hotkeys 和jquery)。 之后,您必须声明对 ...
#About jQuery Hotkeys是一个插件,可让您轻松地在代码中的任意位置添加和删除键盘事件处理程序,从而支持几乎任何按键组合。 该插件基于Tzury Bar Yochay的插件: 语法如下: $(expression).bind(types.keys, ...
Active Hotkeys – 寻找系统的全局热键
作者: Arjen Broeze. Hotkeys 可以定义Windows系统热键,用来启动应用程序,发送按键序列给其它程序,退出Windows或者重新启动等,带有全部源程序。发布者:cjsh(wjh_wy@163.com) QQ:39306255
jQuery键盘按键监听提示代码是一款基于jquery.hotkeys插件实现的支持多复合键键盘监听事件特效。
内容索引:脚本资源,jQuery,hotkeys,键盘 jQuery hotkeys 是一个键盘触发事件快速构建插件,帮你快速创建键盘触发事件,支持任意键组合。当你每敲击一下键盘,它就会在图上帮你记录下键盘的位置,它允许你使用组合键...
前端开源库-hotkeys-js热键JS,一个简单的微型库,用于定义和分配键盘快捷键。它没有依赖关系。