-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathapp.js
More file actions
23 lines (20 loc) · 769 Bytes
/
app.js
File metadata and controls
23 lines (20 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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");
// This change was made by Tanushree Nayal
const colors = ["green", "red", "rgba(133,122,200)", "#f15025"];
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");
});