add support for custom keyboard availability condition
This commit is contained in:
parent
731598f7c8
commit
3b111a1cd4
1 changed files with 9 additions and 0 deletions
|
@ -44,6 +44,9 @@ var Reveal = (function(){
|
||||||
// Enable keyboard shortcuts for navigation
|
// Enable keyboard shortcuts for navigation
|
||||||
keyboard: true,
|
keyboard: true,
|
||||||
|
|
||||||
|
// Optional function that blocks keyboard events when retuning false
|
||||||
|
keyboardCondition: null,
|
||||||
|
|
||||||
// Enable the slide overview mode
|
// Enable the slide overview mode
|
||||||
overview: true,
|
overview: true,
|
||||||
|
|
||||||
|
@ -2836,6 +2839,12 @@ var Reveal = (function(){
|
||||||
*/
|
*/
|
||||||
function onDocumentKeyDown( event ) {
|
function onDocumentKeyDown( event ) {
|
||||||
|
|
||||||
|
// If there's a condition specified and it returns false,
|
||||||
|
// ignore this event
|
||||||
|
if( typeof config.keyboardCondition === 'function' && config.keyboardCondition() === false ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Remember if auto-sliding was paused so we can toggle it
|
// Remember if auto-sliding was paused so we can toggle it
|
||||||
var autoSlideWasPaused = autoSlidePaused;
|
var autoSlideWasPaused = autoSlidePaused;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue