Files
aifo-portal-web/js/partnership.js
T
2026-07-02 18:15:06 +08:00

35 lines
821 B
JavaScript

/**
* Partnership page — FAQ accordion.
*/
(function () {
function initFaq(root) {
if (!root) return;
root.querySelectorAll(".faq-header").forEach(function (header) {
header.addEventListener("click", function () {
var item = header.closest(".faq-item");
if (!item) return;
var isActive = item.classList.contains("active");
root.querySelectorAll(".faq-item").forEach(function (el) {
el.classList.remove("active");
});
if (!isActive) {
item.classList.add("active");
}
});
});
}
function init() {
initFaq(document.querySelector("#partnership-page .partnership-faq"));
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();