generated from beasmith152/Boilerplate-Web-dev-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
20 lines (17 loc) · 642 Bytes
/
script.js
File metadata and controls
20 lines (17 loc) · 642 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Check JS is Connected
console.log('I am present');
// Mobile Menu
document.addEventListener('DOMContentLoaded', function() {
// Mobile Menu
function toggleMenu() {
const navLinks = document.querySelector('.navlinks');
if (navLinks.style.display === 'flex') {
navLinks.style.display = 'none';
} else {
navLinks.style.display = 'flex';
navLinks.style.flexDirection = 'column'; // Ensure it displays correctly
}
}
// Attach the toggleMenu function to the hamburger button
document.querySelector('.hamburger').addEventListener('click', toggleMenu);
});