From c6f2070c6c43c320b82d89288bfbdd8c63e206a3 Mon Sep 17 00:00:00 2001 From: Surjith S M Date: Tue, 20 Jun 2023 13:14:48 +0530 Subject: [PATCH] fix toggle logic --- package.json | 2 +- src/Astronav.astro | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0fc4db1..2ee3a6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "astro-navbar", - "version": "1.2.1", + "version": "1.2.2", "description": "Responsive Mobile Navigation with Dropdown in Astro", "type": "module", "exports": "./index.ts", diff --git a/src/Astronav.astro b/src/Astronav.astro index fa8c8ac..0f09bc9 100644 --- a/src/Astronav.astro +++ b/src/Astronav.astro @@ -28,7 +28,10 @@ } else { menu.setAttribute("open", ""); } - button?.nextElementSibling?.classList.toggle("hidden"); + // Toggle Dropdown Content + const dropdownToggle = button?.querySelector(".dropdown-toggle"); + dropdownToggle?.classList.toggle("hidden"); + // Close one dropdown when selecting another Array.from(dropdownMenus) .filter((el) => el !== menu)