-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
32 lines (28 loc) · 1004 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Footer animate on
const app = Array.from(document.querySelectorAll(".app"));
app.forEach((app, i) => {
const setActive = () => app.classList.add("active");
const runSequence = () => setTimeout(setActive, 40 * i);
setTimeout(runSequence, 500);
});
// Logo color mixup on keydown
const input = document.querySelector(".searchInput");
const letters = Array.from(document.querySelectorAll(".letter"));
const cycleColor = () => {
letters.forEach(letter => {
if (letter.classList.contains("red")) {
letter.classList.remove("red");
letter.classList.add("blue");
} else if (letter.classList.contains("blue")) {
letter.classList.remove("blue");
letter.classList.add("green");
} else if (letter.classList.contains("green")) {
letter.classList.remove("green");
letter.classList.add("yellow");
} else {
letter.classList.remove("yellow");
letter.classList.add("red");
}
});
};
input.addEventListener("keydown", () => cycleColor());