Skip to content

Commit

Permalink
add click event to demo hamburger
Browse files Browse the repository at this point in the history
  • Loading branch information
TomoyaKuroda committed May 28, 2024
1 parent 6fa41fa commit daf30b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ <h3>Acknowledgments</h3>
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;
Expand All @@ -304,6 +304,13 @@ <h3>Acknowledgments</h3>
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');
});


</script>
</body>

Expand Down

0 comments on commit daf30b4

Please sign in to comment.