How to implement keyboard shortcuts on websites
Where should I begin if I want users to be able 开发者_JAVA技巧to use keyboard shortcuts on a site. I'm currently using php and jquery to create site. How will I be able to add keyboard shortcuts aside from the usual point and click method. Links to site where I could begin will do. Thanks.
As a starter: http://plugins.jquery.com/project/hotkeys
[Edit 1/14/14: Dead link. See the Github page instead]
Take a look at Mousetrap as well.
http://craig.is/killing/mice
It supports all types of key events as well as combinations and sequences.
I've used jQuery.hotkeys by John Resig, and it works pretty well with the latest jQuery. Have a look at the static page samples on the github page.
Maybe also look into using the accesskey
attribute.
Try this plugin http://www.mattytemple.com/projects/shortcut-js/. It is simplistic in purpose and handles single combinations effectively.
If you need better implementation with more flexibility go for Mousetrap Plugin as specified by @craig in the previous answer.
精彩评论