-
Notifications
You must be signed in to change notification settings - Fork 6
/
scripts.js
42 lines (34 loc) · 1.17 KB
/
scripts.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
document.addEventListener('click', function(e) {
const droplet = document.createElement('div');
droplet.classList.add('droplet');
droplet.style.top = `${e.clientY + window.scrollY}px`;
droplet.style.left = `${e.clientX + window.scrollX}px`;
droplet.style.backgroundColor = '#008080';
document.body.appendChild(droplet);
droplet.addEventListener('animationend', () => {
droplet.remove();
});
});
function getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
const table = document.getElementById('expandable-table');
const toggleText = document.getElementById('toggle-table');
toggleText.addEventListener('click', () => {
if (table.classList.contains('open')) {
table.classList.add('closing');
table.classList.remove('open');
toggleText.textContent = 'View segment map';
setTimeout(() => {
table.classList.remove('closing');
}, 300);
} else {
table.classList.add('open');
toggleText.textContent = 'Hide segment map';
}
});