Browse Source

Fix button menu toggle with overlay

master
Eduard Kuzmenko 4 years ago
parent
commit
8f5438a323
  1. 4
      src/components/buttonMenuToggle.ts
  2. 2
      src/components/misc.ts
  3. 9
      src/scss/partials/_button.scss

4
src/components/buttonMenuToggle.ts

@ -1,6 +1,6 @@
import ButtonIcon from "./buttonIcon"; import ButtonIcon from "./buttonIcon";
import ButtonMenu, { ButtonMenuItemOptions } from "./buttonMenu"; import ButtonMenu, { ButtonMenuItemOptions } from "./buttonMenu";
import { openBtnMenu } from "./misc"; import { closeBtnMenu, openBtnMenu } from "./misc";
const ButtonMenuToggle = (options: Partial<{noRipple: true, onlyMobile: true}> = {}, direction: 'bottom-left', buttons: ButtonMenuItemOptions[]) => { const ButtonMenuToggle = (options: Partial<{noRipple: true, onlyMobile: true}> = {}, direction: 'bottom-left', buttons: ButtonMenuItemOptions[]) => {
const button = ButtonIcon('more btn-menu-toggle', options); const button = ButtonIcon('more btn-menu-toggle', options);
@ -23,7 +23,7 @@ const ButtonMenuToggleHandler = (el: HTMLElement) => {
if(el.classList.contains('menu-open')) { if(el.classList.contains('menu-open')) {
el.classList.remove('menu-open'); el.classList.remove('menu-open');
openedMenu.classList.remove('active'); closeBtnMenu();
} else { } else {
openBtnMenu(openedMenu); openBtnMenu(openedMenu);
} }

2
src/components/misc.ts

@ -136,7 +136,7 @@ let onClick = (e: MouseEvent | TouchEvent) => {
closeBtnMenu(); closeBtnMenu();
}; };
let closeBtnMenu = () => { export const closeBtnMenu = () => {
if(openedMenu) { if(openedMenu) {
openedMenu.classList.remove('active'); openedMenu.classList.remove('active');
openedMenu.parentElement.classList.remove('menu-open'); openedMenu.parentElement.classList.remove('menu-open');

9
src/scss/partials/_button.scss

@ -148,11 +148,12 @@
} */ } */
&-overlay { &-overlay {
position: fixed !important; position: fixed !important;
left: 0; left: -100vw;
right: 0; right: -100vw;
top: 0; top: -100vh;
bottom: 0; bottom: -100vh;
z-index: 1; z-index: 1;
cursor: default;
//background-color: rgba(0, 0, 0, .2); //background-color: rgba(0, 0, 0, .2);
} }
} }

Loading…
Cancel
Save