How to implement keyboard shortcuts on websites

你说的曾经没有我的故事 提交于 2019-11-27 18:22:46

问题


Where should I begin if I want users to be able 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.


回答1:


As a starter: http://plugins.jquery.com/project/hotkeys

[Edit 1/14/14: Dead link. See the Github page instead]




回答2:


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.




回答3:


Maybe also look into using the accesskey attribute.




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/4723334/how-to-implement-keyboard-shortcuts-on-websites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!