diff --git a/src/js/main.js b/src/js/main.js index d9b3441..c093304 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -363,6 +363,24 @@ if (document.body.dataset.page === "integrations") { } } +// Add underline class to menu links on Mobile + +function setActiveMenuItem() { + const currentPath = window.location.pathname; + const menuItems = document.querySelectorAll("[data-el-menu] a"); + + menuItems.forEach((item) => { + const itemPathname = item.pathname; + const shouldBeUnderlined = + itemPathname !== "/" && currentPath.startsWith(itemPathname); + + item.classList.toggle("border-b-2", shouldBeUnderlined); + item.classList.toggle("border-gray-600", shouldBeUnderlined); + }); +} + +setActiveMenuItem(); + // Change header style const header = document.querySelector("#header"); diff --git a/src/partials/layout.html b/src/partials/layout.html index f9a8afe..217de2e 100644 --- a/src/partials/layout.html +++ b/src/partials/layout.html @@ -56,7 +56,7 @@
-