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.
55 lines
1.5 KiB
55 lines
1.5 KiB
import "./common.js";
|
|
//#region js/investment.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 initAnnounceSwiper() {
|
|
const root = document.querySelector(".iv-announce");
|
|
const el = root?.querySelector(".iv-announce__swiper");
|
|
if (!root || !el || !window.Swiper) return;
|
|
new window.Swiper(el, {
|
|
slidesPerView: 4,
|
|
spaceBetween: 40,
|
|
speed: 600,
|
|
navigation: {
|
|
prevEl: root.querySelector(".iv-announce__head .s-arrows__prev"),
|
|
nextEl: root.querySelector(".iv-announce__head .s-arrows__next")
|
|
},
|
|
breakpoints: {
|
|
0: {
|
|
slidesPerView: 1.15,
|
|
spaceBetween: 16,
|
|
navigation: {
|
|
prevEl: root.querySelector(".iv-announce__arrows-mobile .s-arrows__prev"),
|
|
nextEl: root.querySelector(".iv-announce__arrows-mobile .s-arrows__next")
|
|
}
|
|
},
|
|
768: {
|
|
slidesPerView: 2,
|
|
spaceBetween: 24
|
|
},
|
|
1200: {
|
|
slidesPerView: 4,
|
|
spaceBetween: 40
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function initLearnItemClick() {
|
|
$(".iv-learn__item").on("click", function(event) {
|
|
if ($(event.target).closest("a").length) return;
|
|
const href = $(this).find("a[href]").attr("href");
|
|
if (href) window.location.href = href;
|
|
});
|
|
}
|
|
$(function() {
|
|
setActiveNav();
|
|
initAnnounceSwiper();
|
|
initLearnItemClick();
|
|
});
|
|
//#endregion
|