forked from john-smilga/javascript-basic-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
20 lines (18 loc) · 660 Bytes
/
app.js
File metadata and controls
20 lines (18 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// classList - shows/gets all classes
// contains - checks classList for specific class
// add - add class
// remove - remove class
// toggle - toggles class
const navToggle = document.querySelector(".nav-toggle");
const links = document.querySelector(".links");
navToggle.addEventListener("click", function () {
// console.log(links.classList);
// console.log(links.classList.contains("random"));
// console.log(links.classList.contains("links"));
// if (links.classList.contains("show-links")) {
// links.classList.remove("show-links");
// } else {
// links.classList.add("show-links");
// }
links.classList.toggle("show-links");
});