From daf30b41e7924fb2c4ed5728cb26891b4fd9ed8e Mon Sep 17 00:00:00 2001 From: Tomoya Kuroda Date: Tue, 28 May 2024 11:44:02 -0400 Subject: [PATCH] add click event to demo hamburger --- index.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 276fecf..d31627f 100644 --- a/index.html +++ b/index.html @@ -279,8 +279,8 @@

Acknowledgments

document.querySelector('.hamburger-container').appendChild(clone); }); + const demo = document.getElementById('demo'); function updateCSSVariables() { - const demo = document.getElementById('demo'); const hamburgerPaddingX = document.getElementById('hamburger-padding-x').value; const hamburgerPaddingY = document.getElementById('hamburger-padding-y').value; const hamburgerLayerWidth = document.getElementById('hamburger-layer-width').value; @@ -304,6 +304,13 @@

Acknowledgments

demo.style.setProperty('--hamburger-active-hover-opacity', hamburgerActiveHoverOpacity); demo.classList.toggle('is-active', hamburgerCheckbox); } + + demo.addEventListener("click", function() { + demo.classList.toggle("is-active"); + document.getElementById('hamburger-checkbox').checked = demo.classList.contains('is-active'); + }); + +