You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
992 B
26 lines
992 B
import "./common.js";
|
|
//#region js/faq.js
|
|
function setActiveNav() {
|
|
const pageNav = document.querySelector("[data-nav]")?.getAttribute("data-nav");
|
|
if (!pageNav) return;
|
|
document.querySelectorAll(".site-header__nav a").forEach((link) => {
|
|
const active = link.textContent.trim().startsWith(pageNav);
|
|
link.classList.toggle("is-active", active);
|
|
});
|
|
}
|
|
$(function() {
|
|
setActiveNav();
|
|
$(".f-tabs__item").on("click", function() {
|
|
const $btn = $(this);
|
|
$btn.addClass("is-active").attr("aria-selected", "true");
|
|
$btn.siblings(".f-tabs__item").removeClass("is-active").attr("aria-selected", "false");
|
|
});
|
|
$(".f-item__trigger").on("click", function() {
|
|
const $item = $(this).closest(".f-item");
|
|
const willOpen = !$item.hasClass("is-open");
|
|
$(".f-item.is-open").not($item).removeClass("is-open").find(".f-item__trigger").attr("aria-expanded", "false");
|
|
$item.toggleClass("is-open", willOpen);
|
|
$(this).attr("aria-expanded", willOpen ? "true" : "false");
|
|
});
|
|
});
|
|
//#endregion
|