Minor documentation updates to input.hotkey.js (#2721)

Credit to @SebastiaanKloos
This commit is contained in:
Sebastiaan Kloos 2018-11-23 08:09:45 +01:00 committed by Luke Towers
parent 329bb6f202
commit 9c2bb8469e
2 changed files with 12 additions and 4 deletions

View File

@ -18,4 +18,12 @@ Allows keyboard shortcuts (hotkeys) to be bound to an element's click event.
Press "Shift + R" on your keyboard
</button>
## Javascript API
If you use a selector other than a button or a link, you will need to add the `hotkeyVisible` property to the hotkey config.
$('html').hotKey({
hotkey: 'ctrl+s, cmd+s',
hotkeyVisible: false,
callback: doSomething
});

View File

@ -1,12 +1,12 @@
/*
* Hot key binding.
*
*
* Data attributes:
* - data-hotkey="ctrl+s, cmd+s" - enables the hotkey plugin
*
* JavaScript API:
*
* $('html').hotKey({ hotkey: 'ctrl+s, cmd+s', callback: doSomething);
* $('html').hotKey({ hotkey: 'ctrl+s, cmd+s', hotkeyVisible: false, callback: doSomething });
*/
+function ($) { "use strict";
@ -209,9 +209,9 @@
// HOTKEY DATA-API
// ==============
$(document).render(function() {
$('[data-hotkey]').hotKey()
})
}(window.jQuery);
}(window.jQuery);