Navigation drawer key handling
Drawer opens on 'm' and closes on 'Esc'
This commit is contained in:
parent
352182ae10
commit
c910225e7d
1 changed files with 15 additions and 0 deletions
|
@ -52,6 +52,21 @@ var main = function () { // main function; called below
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keyhandling for the navigation drawer.
|
||||||
|
* opens the drawer on 'm' (key code: 77)
|
||||||
|
* closes the drawer on 'Esc' (key code: 27)
|
||||||
|
*/
|
||||||
|
$(document).keyup(function (e) {
|
||||||
|
if (navOpen && (e.which === 27)) {
|
||||||
|
closeNav();
|
||||||
|
navOpen = false;
|
||||||
|
} else if (!(navOpen) && (e.which === 77)) {
|
||||||
|
openNav();
|
||||||
|
navOpen = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in a new issue