Sunday 17 March 2013

Mousetrap: Keyboard Shortcuts In Javascript


It works with single, multiple (combination) or with a sequence of keys. Also, we can listen to keypress, keydown or keyup events and decide to trigger any functions accordingly.

If you’re sick of using a mouse while browsing, then check out Mousetrap. Mousetrap is a Javascript library used to create and manage keyboard shortcuts.

Mousetrap is a tiny 1.6KB program when minified/gzipped, so its tiny footprint won’t get in the way and you can use it in all major browsers.

You can assign either shift, CTRL, ALT, option, meta, and command as modifier keys. Shortcuts can be single, multiple (combination) or a sequence of keys. Advanced users can also assign arguments to listen for keypress, keydown and keyup, but it’s not recommended for anyone who is unsure.

Should your mouse be worried?

Features:

  • Supported in Internet Explorer 6+, Safari, Firefox, Chrome.
  • Use shift, ctrl, alt, option, meta, and command for modifier keys.
  • Stand-alone library.
  • Small footprint (1.6 KB minified/gzipped).

Check out Mousetrap @ http://craig.is/killing/mice

No comments:

Post a Comment