Ruby on Rails: How do I implement shortcut keys in my webapp?
I've heard about javascript solutions, and accessorkeys...
Don't know either... but there seem to be mixed feelings about which to use.
I want standard key shortcuts for each OS (command for mac, ctrl for everything else)
any help / links / tutoria开发者_运维知识库ls would be very appreciated.
Try using js-hotkeys.
jQuery.Hotkeys plugin lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination. It takes one line of code to bind/unbind a hot key combination.
Binding 'Ctrl+c'
$(document).bind('keydown', 'ctrl+c', fn);
精彩评论