From fb9a5b8ca45e3f04db062ce26ce3768bc75f8539 Mon Sep 17 00:00:00 2001 From: Patrick Fleming Date: Fri, 18 Oct 2024 10:36:36 +0100 Subject: [PATCH] Add JS handler for hamburger menu --- app/javascript/application.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/javascript/application.js b/app/javascript/application.js index f806ca27..188ec610 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,2 +1,11 @@ // Entry point for the build script in your package.json import "@hotwired/turbo-rails"; + +document.addEventListener("DOMContentLoaded", function () { + const hamburgerMenu = document.getElementById("hamburger-menu"); + const menuList = document.getElementById("menu-list"); + + hamburgerMenu.addEventListener("click", function () { + menuList.classList.toggle("hidden"); + }); +});