简体   繁体   中英

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 / tutorials 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM