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

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