-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
69 lines (56 loc) · 1.92 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const developerText = document.querySelector('#developer-text');
const engineerText = document.querySelector('#engineer-text');
const textLoad = () => {
setTimeout(() => {
developerText.textContent = "Developer";
engineerText.textContent = "Engineer";
}, 0);
setTimeout(() => {
developerText.textContent = "Engineer";
engineerText.textContent = "Developer";
}, 8000);
}
textLoad();
setInterval(textLoad, 16000);
"use strict";
let sleep = (time) => new Promise(resolve => setTimeout(resolve, time));
let upload = document.querySelector(".upload");
let uploadBtn = document.querySelector(".upload__button");
uploadBtn.addEventListener("click", async () => {
upload.classList.add("uploading");
await sleep(3000);
upload.classList.add("uploaded");
await sleep(2000);
upload.classList.remove("uploading");
upload.classList.add("uploaded-after");
await sleep(1000);
upload.className = "upload";
});
// change 'web' and 'software'
//Box zooming in
// document.addEventListener('DOMContentLoaded', () => {
// const boxes = document.querySelectorAll('.box');
// boxes.forEach(box => {
// box.addEventListener('click', () => {
// box.classList.toggle('zoomed');
// });
// });
// });
document.addEventListener('DOMContentLoaded', () => {
const boxes = document.querySelectorAll('.box');
let currentlyZoomedBox = null;
boxes.forEach(box => {
box.addEventListener('click', () => {
if (currentlyZoomedBox && currentlyZoomedBox !== box) {
currentlyZoomedBox.classList.remove('zoomed');
}
if (box.classList.contains('zoomed')) {
box.classList.remove('zoomed');
currentlyZoomedBox = null;
} else {
box.classList.add('zoomed');
currentlyZoomedBox = box;
}
});
});
});