Skip to content

Commit

Permalink
Create script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KrishnaSSH authored Mar 11, 2024
1 parent 3dd9082 commit 60a60ff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions static/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
document.addEventListener('DOMContentLoaded', function() {
const hamburger = document.getElementById('hamburger');
const menu = document.querySelector('nav');

hamburger.addEventListener('click', function() {
menu.classList.toggle('show');
});

// Close the menu when a menu item is clicked
document.querySelectorAll('nav a').forEach(item => {
item.addEventListener('click', () => {
menu.classList.remove('show');
});
});
});

0 comments on commit 60a60ff

Please sign in to comment.