Skip to content

Commit

Permalink
Create menu.js
Browse files Browse the repository at this point in the history
  • Loading branch information
EDU-MDAnderson committed Sep 24, 2023
1 parent 926f79c commit 28a890b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// JavaScript for mobile menu functionality
const menuToggle = document.getElementById('menu-toggle');
const mainNav = document.getElementById('main-nav');

menuToggle.addEventListener('click', () => {
mainNav.classList.toggle('show-menu');
if (mainNav.classList.contains('show-menu')) {
menuToggle.textContent = '✕'; // Change the button text to '✕' when menu is open
} else {
menuToggle.textContent = '☰'; // Change it back to '☰' when menu is closed
}
});

0 comments on commit 28a890b

Please sign in to comment.