#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.
It is based on a library [Shortcut.js](http://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js) written by [Binny V A](http://www.openjs.com/).
The syntax is as follows:
<pre>
$(expression).bind(<types>,<options>, <handler>);
$(expression).unbind(<types>,<options>, <handler>);
$(document).bind('keydown', 'Ctrl+a', fn);
// e.g. replace '$' sign with 'EUR'
$('input.foo').bind('keyup', '$', function(){
this.value = this.value.replace('$', 'EUR');
});
$('div.foo').unbind('keydown', 'Ctrl+a', fn);
</pre>
## [Live Demo](http://jshotkeys.googlepages.com/test-static-01.html)
## Types
Supported types are `'keydown'`, `'keyup'` and `'keypress'`
## Options
The options are `'combi'` i.e. the key combination, and `'disableInInput'` which allow your code not to be executed when the cursor is located inside an input ( `$(elem).is('input') || $(elem).is('textarea')` ).
As you can see, the key combination can be passed as string or as an object. You may pass an object in case you wish to override the default option for `disableInInput` which is set to `false`:
<pre>
$(document).bind('keydown', {combi:'a', disableinInput: true}, fn);
</pre>
I.e. when cursor is within an input field, `'a'` will be inserted into the input field without interfering.
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
Modifiers are case insensitive, i.e. 'Ctrl+a' 'ctrl+a'.
## Handler
In previous versions there was an option propagate which is removed now and implemented at the user code level.
When using jQuery, if an event handler returns false, jQuery will call `stopPropagation()` and `preventDefault()`
## jQuery Compatibility
Tested with *jQuery 1.2.6*
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
## Features added in this version (0.7.x)
* Implemented as $.fn - let you use `this`.
* jQuery selectors are supported.
* Extending `$.fn.bind` and `$.fn.unbind` so you get a single interface for binding events to handlers
## Overriding jQuery
The plugin wraps the following jQuery methods:
* $.fn.bind
* $.fn.unbind
* $.find
Even though the plugin overrides these methods, the original methods will *always* be called.
The plugin will add functionality only for the `keydown`, `keyup` and `keypress` event types. Any other types are passed untouched to the original `'bind()'` and `'unbind()'` methods.
Moreover, if you call `bind()` without passing the shortcut key combination e.g. `$(document).bind('keydown', fn)` only the original `'bind()'` method will be executed.
I also modified the `$.fn.find` method by adding a single line at the top of the function body. here is the code:
<pre>
jQuery.fn.find = function( selector ) {
// the line I added
this.query=selector;
// call jQuery original find
return jQuery.fn.__find__.apply(this, arguments);
};
</pre>
You can read about this at [jQuery's User Group](http://groups.google.com/group/jquery-en/browse_thread/thread/18f9825e8d22f18d)
###Notes
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.*
###Current Version is: beta 0.7
没有合适的资源?快使用搜索试试~ 我知道了~
Jquery经典插件收集
共389个文件
jpg:128个
png:77个
gif:72个
5星 · 超过95%的资源 需积分: 9 26 下载量 135 浏览量
2011-10-21
09:23:15
上传
评论
收藏 6.41MB RAR 举报
温馨提示
Jquery 常用插件,包括好几种图片展示,放大插件,hotkeys,定时插件,仿腾讯,新浪,家乐福图片展示特效,带动画特效的分享插件,表单等等,分享给大家
资源推荐
资源详情
资源评论
收起资源包目录
Jquery经典插件收集 (389个子文件)
Web.config 313B
Control.css 9KB
jquery.fancybox-1.3.4.css 9KB
asyncbox.css 7KB
tn3.css 6KB
jm.min.css 6KB
16sucai.css 6KB
asyncbox.css 6KB
asyncbox.css 6KB
asyncbox.css 6KB
blocks.css 5KB
css.css 4KB
css.css 4KB
common.css 3KB
desktop.css 3KB
jquery.jqzoom.css 2KB
index.css 2KB
style.css 932B
styleload.css 121B
Thumbs.db 111KB
Thumbs.db 90KB
Thumbs.db 75KB
Thumbs.db 64KB
Thumbs.db 61KB
Thumbs.db 54KB
Thumbs.db 54KB
Thumbs.db 52KB
Thumbs.db 51KB
Thumbs.db 50KB
Thumbs.db 25KB
Thumbs.db 19KB
Thumbs.db 8KB
Thumbs.db 7KB
Thumbs.db 3KB
banner-01.gif 84KB
asyncbox_tipsbar_bg.gif 18KB
asyncbox_tipsbar_bg.gif 18KB
asyncbox_tipsbar_bg.gif 18KB
asyncbox_tipsbar_bg.gif 18KB
index_spirit_title.gif 8KB
kakaFoucs_bg.gif 7KB
asyncbox_icon.gif 6KB
asyncbox_icon.gif 6KB
loader.gif 5KB
asyncbox_icon.gif 4KB
waitinfo.gif 4KB
monkey.gif 3KB
asyncbox_icon.gif 3KB
module-title-nav-bg.gif 3KB
asyncbox_bg.gif 3KB
startbutton.gif 2KB
asyncbox_bg.gif 2KB
zoomloader.gif 2KB
cmdbutton.gif 2KB
asyncbox_bg.gif 2KB
button.gif 1KB
tips_bg.gif 1KB
tips_bg.gif 1KB
tips_bg.gif 1KB
tips_bg.gif 1KB
asyncbox_tipsbar_icon.gif 1KB
asyncbox_tipsbar_icon.gif 1KB
asyncbox_tipsbar_icon.gif 1KB
asyncbox_tipsbar_icon.gif 1KB
page_go.gif 1KB
user_edit.gif 1KB
user_add.gif 1012B
user_suit.gif 1004B
appbar_bg.gif 988B
book_sub.gif 956B
book_plus.gif 952B
taskbar-start-panel-bg.gif 890B
09562952.gif 838B
item-over.gif 820B
appbar_sp_bg.gif 816B
dialog_closebtn.gif 794B
wait.gif 771B
wait.gif 771B
wait.gif 771B
wait.gif 771B
wait_bg.gif 702B
wait_bg.gif 702B
wait_bg.gif 702B
wait_bg.gif 702B
preload.gif 676B
bin_closed.gif 574B
pencil.gif 331B
taskbar-split-h.gif 327B
ig_treePlus.gif 309B
ig_treeSub.gif 299B
action_save.gif 279B
action_stop.gif 258B
top_cat_bg.gif 219B
asyncbox_title_bottom.gif 217B
asyncbox_title_bottom.gif 204B
taskbuttons-panel-bg.gif 195B
icon.gif 160B
book_item - 副本.gif 139B
asyncbox_title_bottom.gif 138B
book_item.gif 118B
共 389 条
- 1
- 2
- 3
- 4
资源评论
- small_Y2013-11-08一部分很好!
- M0313042013-05-03很完整,非常不错!
雾中的回忆
- 粉丝: 22
- 资源: 30
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功