From c910225e7d2517a8fba4620a1b7f055f8fe06cda Mon Sep 17 00:00:00 2001 From: mmk2410 Date: Wed, 18 Nov 2015 15:48:44 +0100 Subject: [PATCH] Navigation drawer key handling Drawer opens on 'm' and closes on 'Esc' --- res/js/app.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/res/js/app.js b/res/js/app.js index 29452cd..56dae56 100644 --- a/res/js/app.js +++ b/res/js/app.js @@ -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; + } + }); + };