-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (19 loc) · 766 Bytes
/
index.js
File metadata and controls
24 lines (19 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use strict";
function burgerClick() {
const hamburger = document.querySelector('.hamburger'); // selects hamburger icon.
const navLinks = document.querySelector('.nav-links'); // selects nav-links element
const links = document.querySelectorAll(".nav-links li"); // selects all the li's in nav-links
hamburger.addEventListener("click", function(event) { // on click of the hamburger icon...
navLinks.classList.toggle('open'); // toggle the "open" style
links.forEach(function(link) {
link.classList.toggle('fade');
});
});
}
function setupEventHandlers() {
burgerClick();
}
function initialize() {
setupEventHandlers();
}
$(initialize);