diff --git a/themes/custom/ts_wrin/js/components/ts_header_nav.js b/themes/custom/ts_wrin/js/components/ts_header_nav.js index 2ff9c9ed3..12da3a0e5 100644 --- a/themes/custom/ts_wrin/js/components/ts_header_nav.js +++ b/themes/custom/ts_wrin/js/components/ts_header_nav.js @@ -340,12 +340,14 @@ export default function(context) { }); } - // Close the menu if clicking outside of it - document.addEventListener("click", function() { - if (menuContainer.classList.contains("menu-open")) { - menuContainer.classList.remove("menu-open"); - menuContainer.classList.add("menu-closed"); - } - }); + if (menuContainer) { + // Close the menu if clicking outside of it + document.addEventListener("click", function() { + if (menuContainer.classList.contains("menu-open")) { + menuContainer.classList.remove("menu-open"); + menuContainer.classList.add("menu-closed"); + } + }); + } } }