You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to init / destroy a slinky menu, depending on the viewport size.
I'm using this function on resize:
const handleMenuMobile = function () {
if (window.matchMedia("(max-width: 1099px)").matches) {
const menuMobile = $('.menu-wrapper').slinky({
title: true,
theme: ''
});
console.log (menuMobile);
}
if (window.matchMedia("(min-width: 1100px)").matches) {
if (typeof menuMobile !== 'undefined') {
menuMobile.destroy();
}
}
}
The second bit of code (min-width: 1100px) doesn't work because it always returns menuMobile as undefined. I'm guessing this is a scope problem... Can you help me fix this?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Hello, I'm trying to init / destroy a slinky menu, depending on the viewport size.
I'm using this function on resize:
The second bit of code (min-width: 1100px) doesn't work because it always returns menuMobile as undefined. I'm guessing this is a scope problem... Can you help me fix this?
Thanks in advance.
The text was updated successfully, but these errors were encountered: