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 @@ @@ -1,6 +1,6 @@
import ButtonIcon from "./buttonIcon";
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 button = ButtonIcon('more btn-menu-toggle', options);
@ -23,7 +23,7 @@ const ButtonMenuToggleHandler = (el: HTMLElement) => { @@ -23,7 +23,7 @@ const ButtonMenuToggleHandler = (el: HTMLElement) => {
if(el.classList.contains('menu-open')) {
el.classList.remove('menu-open');
openedMenu.classList.remove('active');
closeBtnMenu();
} else {
openBtnMenu(openedMenu);
}

2
src/components/misc.ts

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

9
src/scss/partials/_button.scss

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

Loading…
Cancel
Save