Navigation drawer key handling

Drawer opens on 'm' and closes on 'Esc'
This commit is contained in:
mmk2410 2015-11-18 15:48:44 +01:00
parent 352182ae10
commit c910225e7d
1 changed files with 15 additions and 0 deletions

View File

@ -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;
}
});
};