-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
44 lines (37 loc) · 1.46 KB
/
script.js
File metadata and controls
44 lines (37 loc) · 1.46 KB
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
// Function to toggle the dropdown content
function toggleDropdown(event) {
let dropdownContent = document.getElementById("dropdown-content");
if (dropdownContent.style.display === "none" || dropdownContent.style.display === "") {
dropdownContent.style.display = "grid";
// Add event listener to hide dropdown when clicking outside of it
document.addEventListener('click', hideDropdownOnClickOutside);
} else {
dropdownContent.style.display = "none";
// Remove event listener when hiding dropdown
document.removeEventListener('click', hideDropdownOnClickOutside);
}
// Stop event propagation
event.stopPropagation();
}
// Function to hide dropdown when clicking outside of it
function hideDropdownOnClickOutside(event) {
let dropdown = document.getElementById("dropdown-content");
let button = document.getElementById("past-events-drop-btn");
if (!dropdown.contains(event.target) && !button.contains(event.target)) {
dropdown.style.display = "none";
document.removeEventListener('click', hideDropdownOnClickOutside);
}
}
//image zoom in and out
function ToggleZoom(imageId) {
let isZoomed = false;
let zoomIn = document.getElementById(imageId);
let zoomInStyle = window.getComputedStyle(zoomIn);
if (zoomInStyle.cursor === "zoom-out") {
zoomIn.classList.add("zoomed");
zoomIn.style.cursor = "zoom-in";
} else {
zoomIn.style.cursor = "zoom-out";
zoomIn.classList.remove("zoomed");
}
}