|
|
@ -72,45 +72,57 @@ function initHonorsToggle() { |
|
|
const expanded = list.classList.toggle("is-expanded"); |
|
|
const expanded = list.classList.toggle("is-expanded"); |
|
|
btn.classList.toggle("is-expanded", expanded); |
|
|
btn.classList.toggle("is-expanded", expanded); |
|
|
btn.querySelector("span").textContent = expanded ? t("about.collapse") : t("about.expand_more"); |
|
|
btn.querySelector("span").textContent = expanded ? t("about.collapse") : t("about.expand_more"); |
|
|
|
|
|
if (expanded) list.setAttribute("data-lenis-prevent", ""); |
|
|
|
|
|
else list.removeAttribute("data-lenis-prevent"); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
function initMembersLogosSwiper() { |
|
|
|
|
|
const el = document.querySelector(".ab-members__logos-swiper"); |
|
|
|
|
|
if (!el || !window.Swiper) return; |
|
|
|
|
|
const count = el.querySelectorAll(".ab-members__logo").length; |
|
|
|
|
|
const enableCarousel = count > 5; |
|
|
|
|
|
|
|
|
function initMembersCarousel() { |
|
|
|
|
|
const root = document.querySelector(".ab-members"); |
|
|
|
|
|
const SwiperCtor = window.Swiper; |
|
|
|
|
|
if (!root || !SwiperCtor) return; |
|
|
|
|
|
const el = root.querySelector(".ab-members__panels-swiper"); |
|
|
|
|
|
const buttons = [...root.querySelectorAll(".ab-members__logo")]; |
|
|
|
|
|
if (!el || !buttons.length) return; |
|
|
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches; |
|
|
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches; |
|
|
new window.Swiper(el, { |
|
|
|
|
|
slidesPerView: 5, |
|
|
|
|
|
spaceBetween: 16, |
|
|
|
|
|
watchOverflow: true, |
|
|
|
|
|
rewind: enableCarousel, |
|
|
|
|
|
autoplay: enableCarousel && !reduceMotion ? { |
|
|
|
|
|
|
|
|
const canLoop = buttons.length > 1; |
|
|
|
|
|
const swiper = new SwiperCtor(el, { |
|
|
|
|
|
initialSlide: Math.max(0, buttons.findIndex((btn) => btn.classList.contains("is-active"))), |
|
|
|
|
|
loop: canLoop, |
|
|
|
|
|
grabCursor: true, |
|
|
|
|
|
speed: 600, |
|
|
|
|
|
autoplay: canLoop && !reduceMotion ? { |
|
|
delay: 3e3, |
|
|
delay: 3e3, |
|
|
disableOnInteraction: false, |
|
|
disableOnInteraction: false, |
|
|
pauseOnMouseEnter: true |
|
|
pauseOnMouseEnter: true |
|
|
} : false, |
|
|
|
|
|
breakpoints: { |
|
|
|
|
|
0: { |
|
|
|
|
|
slidesPerView: 2, |
|
|
|
|
|
spaceBetween: 12 |
|
|
|
|
|
}, |
|
|
|
|
|
576: { |
|
|
|
|
|
slidesPerView: 3, |
|
|
|
|
|
spaceBetween: 16 |
|
|
|
|
|
}, |
|
|
|
|
|
993: { |
|
|
|
|
|
slidesPerView: 5, |
|
|
|
|
|
spaceBetween: 16 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} : false |
|
|
|
|
|
}); |
|
|
|
|
|
const logos = root.querySelector(".ab-members__logos"); |
|
|
|
|
|
const syncNav = (index) => { |
|
|
|
|
|
buttons.forEach((btn, i) => { |
|
|
|
|
|
const on = i === index; |
|
|
|
|
|
btn.classList.toggle("is-active", on); |
|
|
|
|
|
btn.setAttribute("aria-selected", on ? "true" : "false"); |
|
|
|
|
|
}); |
|
|
|
|
|
const btn = buttons[index]; |
|
|
|
|
|
if (logos && btn) { |
|
|
|
|
|
const left = btn.offsetLeft - (logos.clientWidth - btn.offsetWidth) / 2; |
|
|
|
|
|
logos.scrollTo({ left: Math.max(0, left), behavior: "smooth" }); |
|
|
} |
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
buttons.forEach((btn, i) => { |
|
|
|
|
|
btn.addEventListener("click", () => { |
|
|
|
|
|
if (canLoop) swiper.slideToLoop(i); |
|
|
|
|
|
else swiper.slideTo(i); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
swiper.on("slideChange", () => syncNav(swiper.realIndex)); |
|
|
|
|
|
syncNav(swiper.realIndex); |
|
|
} |
|
|
} |
|
|
$(function() { |
|
|
$(function() { |
|
|
setActiveNav(); |
|
|
setActiveNav(); |
|
|
initHistorySwiper(); |
|
|
initHistorySwiper(); |
|
|
counterUpInit(); |
|
|
counterUpInit(); |
|
|
initHonorsToggle(); |
|
|
initHonorsToggle(); |
|
|
initMembersLogosSwiper(); |
|
|
|
|
|
|
|
|
initMembersCarousel(); |
|
|
}); |
|
|
}); |
|
|
//#endregion
|
|
|
//#endregion
|