-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
50 lines (45 loc) · 1.61 KB
/
script.js
File metadata and controls
50 lines (45 loc) · 1.61 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
44
45
46
47
48
49
50
// On-scroll animation using Intersection Observer
document.addEventListener("DOMContentLoaded", function() {
// Intersection Observer for fade-in sections
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.1
});
// Observe all elements with the "hidden" class
document.querySelectorAll('.hidden').forEach(element => {
observer.observe(element);
});
const showMoreBtn = document.querySelector(".show-more-btn");
const hiddenAwards = document.querySelectorAll(".hidden-award");
let isExpanded = false;
if (showMoreBtn) {
showMoreBtn.addEventListener("click", () => {
isExpanded = !isExpanded;
hiddenAwards.forEach(card => {
card.style.display = isExpanded ? "block" : "none";
});
showMoreBtn.textContent = isExpanded ? "Show Less" : "Show More";
});
}
// FAQ Accordion
const accordionItems = document.querySelectorAll(".accordion-item");
accordionItems.forEach((item) => {
const header = item.querySelector(".accordion-header");
header.addEventListener("click", () => {
// Close any other open accordion items (optional)
accordionItems.forEach((otherItem) => {
if (otherItem !== item) {
otherItem.classList.remove("active");
}
});
// Toggle the current item
item.classList.toggle("active");
});
});
});