[refactor] improve menu module

This commit is contained in:
Kuldeep M 2019-07-16 20:06:35 +01:00
parent 90bb0f010d
commit b7496ececb

View File

@ -68,12 +68,13 @@ var menu = (function() {
action: function() { action: function() {
mod.close(); mod.close();
render.toggle(); render.toggle();
menu.render.tabindex.toggle(); render.tabindex.toggle();
pagelock.render.toggle(); pagelock.render.toggle();
} }
}); });
} else { } else {
helper.removeClass(html, "is-menu-open"); 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() { var init = function() {
mod.close(); mod.close();
render.toggle(); render.toggle();
@ -102,7 +124,10 @@ var menu = (function() {
return { return {
init: init, init: init,
mod: mod, mod: mod,
render: render render: render,
open: open,
close: close,
toggle: toggle
}; };
})(); })();