-
Notifications
You must be signed in to change notification settings - Fork 5
/
project.js
48 lines (39 loc) · 1.27 KB
/
project.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const messages = ["Projects"];
const preloader = document.getElementById("preloader");
const content = document.getElementById("content");
let currentMessage = 0;
function showNextMessage() {
if (currentMessage < messages.length) {
const messageElement = document.createElement("div");
messageElement.className = "message";
messageElement.textContent = messages[currentMessage];
if (currentMessage === 0) {
messageElement.classList.add("fade-in");
}
preloader.innerHTML = "";
preloader.appendChild(messageElement);
let displayTime = 150;
if (currentMessage === 0) {
displayTime = 800;
}
currentMessage++;
setTimeout(showNextMessage, displayTime);
} else {
content.classList.add("show-content");
content.style.borderBottomLeftRadius = "0";
content.style.borderBottomRightRadius = "0";
setTimeout(() => {
preloader.classList.add("slide-out");
setTimeout(() => {
preloader.style.display = "none";
}, 400);
}, 400);
}
}
window.onload = () => setTimeout(showNextMessage, 700);
function toggleMenu() {
const menu = document.querySelector(".menu-links");
const icon = document.querySelector(".hamburger-icon");
menu.classList.toggle("open");
icon.classList.toggle("open");
}