forked from octoposprime/op-web-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (29 loc) · 1.29 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
document.addEventListener('DOMContentLoaded', function() {
const icons = document.querySelectorAll('.teamIcon');
const popup = document.getElementById('popup');
const popupOverlay = document.getElementById('popupOverlay');
const popupTitle = document.getElementById('popupTitle');
const popupContent = document.getElementById('popupContent');
const container = document.querySelector('.container');
icons.forEach(icon => {
icon.addEventListener('click', function(event) {
popupTitle.textContent = icon.title || "Team Information";
popupContent.textContent = icon.alt;
// Ensure popup and overlay are initially hidden and only displayed through JS
popup.style.display = 'block';
popupOverlay.style.display = 'block';
container.classList.add('blur');
event.stopPropagation();
});
});
document.addEventListener('click', function(event) {
if (!popup.contains(event.target) && !event.target.matches('.teamIcon')) {
popup.style.display = 'none';
popupOverlay.style.display = 'none';
container.classList.remove('blur');
}
});
popup.addEventListener('click', function(event) {
event.stopPropagation();
});
});