From b7496ececb8f2b5c7d3beb804cfdbf3602222d8b Mon Sep 17 00:00:00 2001 From: Kuldeep M Date: Tue, 16 Jul 2019 20:06:35 +0100 Subject: [PATCH] [refactor] improve menu module --- src/js/menu.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/js/menu.js b/src/js/menu.js index ce1b4400..d4fd8e6e 100644 --- a/src/js/menu.js +++ b/src/js/menu.js @@ -68,12 +68,13 @@ var menu = (function() { action: function() { mod.close(); render.toggle(); - menu.render.tabindex.toggle(); + render.tabindex.toggle(); pagelock.render.toggle(); } }); } else { helper.removeClass(html, "is-menu-open"); + shade.destroy(); }; }; @@ -94,6 +95,27 @@ var menu = (function() { } }; + var toggle = function() { + mod.toggle(); + render.toggle(); + render.tabindex.toggle(); + pagelock.render.toggle(); + }; + + var open = function() { + mod.open(); + render.toggle(); + render.tabindex.toggle(); + pagelock.render.toggle(); + }; + + var close = function() { + mod.close(); + render.toggle(); + render.tabindex.toggle(); + pagelock.render.toggle(); + }; + var init = function() { mod.close(); render.toggle(); @@ -102,7 +124,10 @@ var menu = (function() { return { init: init, mod: mod, - render: render + render: render, + open: open, + close: close, + toggle: toggle }; })();