Skip to content
Snippets Groups Projects
Commit f2997eda authored by alexisben's avatar alexisben
Browse files

fix menu breakpoint

parent 23b80904
No related merge requests found
import { breakpoints } from '../utils/breakpoints'; import { breakpoints, isMobile } from '../utils/breakpoints';
import { a11yClick } from '../utils/a11y'; import { a11yClick } from '../utils/a11y';
const CLASSES = { const CLASSES = {
...@@ -59,16 +59,15 @@ class MainMenu { ...@@ -59,16 +59,15 @@ class MainMenu {
} }
resize () { resize () {
const isMobile = window.innerWidth <= breakpoints.md;
document.documentElement.style.setProperty('--header-height', this.element.offsetHeight + 'px'); document.documentElement.style.setProperty('--header-height', this.element.offsetHeight + 'px');
document.documentElement.style.setProperty('--header-menu-max-height', (window.innerHeight - this.element.offsetHeight) + 'px'); document.documentElement.style.setProperty('--header-menu-max-height', (window.innerHeight - this.element.offsetHeight) + 'px');
// is state changed ? // is state changed ?
if (this.state.isMobile === isMobile) { if (this.state.isMobile === isMobile()) {
return null; return null;
} }
this.state.isMobile = isMobile; this.state.isMobile = isMobile();
this.closeEverything(); this.closeEverything();
} }
......
...@@ -8,7 +8,7 @@ const breakpoints = { ...@@ -8,7 +8,7 @@ const breakpoints = {
}; };
const isMobile = function() { const isMobile = function() {
return window.innerWidth <= breakpoints.md return window.innerWidth <= breakpoints.lg
} }
export { export {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment