KeyboardMaster JavaScript has a simple library for handling keyboard shortcuts. This JS library that allows you to bind keyboard shortcuts to any DOM elements.
How to make use of it:
1. Download the package deal and import the principle JavaScript into the HTML doc.
<script src="./lib/index.js"></script>
2. Bind keyboard shortcuts to your component.
document.body.addKeyboardEvents({ keyBindings: { seperator: ' + ', bindings: [ { keyBinding: 'CTRL + ALT + A', action: () => { // do something } }, // more shortcuts here ] } })
3. Use the library to allow a cheat code (e.g. Konami code) on your webpage.
document.body.addKeyboardEvents({ passwordBindings: { timeout: -1, seperator: '-', bindings: [ { passwordBinding: '', action: () => { // do something } } ] } })
Bind Keyboard Shortcuts To Any Elements, bind keyword in javascript, Keyboard Master Plugin/Github
See Demo And Download
Official Website(sahithyandev): Click Here
This superior jQuery/javascript plugin is developed by sahithyandev. For extra Advanced Usages, please go to the official website.
Be First to Comment