Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions src/scripts/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,28 +216,42 @@ function initSwiper(section) {
});
}

function initTab(section) {
const swiper = initSwiper(section);
function slideSwiper(_section, swiper, index) {
swiper.slideTo(index);
}

function handleSlideChange(section, swiper) {
swiper.on('slideChange', () => {
const activeIndex = swiper.activeIndex;
document.querySelectorAll(`.section_${section} .tab_trigger`).forEach(t => t.classList.remove('active'));
document.querySelectorAll(`.section_${section} .tab_trigger`)[activeIndex].classList.add('active');
updateTabBackground(section, activeIndex);
});
}

function handleTabClick(section, swiper, onChange) {
document.querySelectorAll(`.section_${section} .tab_trigger`).forEach((tab, index) => {
tab.addEventListener('click', () => {
document.querySelectorAll(`.section_${section} .tab_trigger`).forEach(t => t.classList.remove('active'));
tab.classList.add('active');
updateTabBackground(section, index);
swiper.slideTo(index);
onChange?.(section, swiper, index);
});
});

swiper.on('slideChange', () => {
const activeIndex = swiper.activeIndex;
document.querySelectorAll(`.section_${section} .tab_trigger`).forEach(t => t.classList.remove('active'));
document.querySelectorAll(`.section_${section} .tab_trigger`)[activeIndex].classList.add('active');
updateTabBackground(section, activeIndex);
});
if(swiper) {
handleSlideChange(section, swiper);
}

document.querySelector(`.section_${section} .tab_trigger`).click();
}

function initTab(section, onChange) {
const swiper = initSwiper(section);

handleTabClick(section, swiper, onChange);
}

function updateTabBackground(section, index) {
const tab = document.querySelectorAll(`.section_${section} .tab_trigger`)[index];
const background = document.querySelector(`.section_${section} .tab_background`);
Expand Down Expand Up @@ -281,6 +295,13 @@ function initRotatingText() {
setInterval(updateWord, ANIMATION_DELAY);
}

function bilingCycle(_section, _swiper, index) {
const billingCosts = document.querySelectorAll(`.fusebox_plan-cost`);
const billingCost = document.querySelectorAll(`.fusebox_plan-cost.is-${index}`);
billingCosts.forEach(cost => cost.style.display = 'none');
billingCost.forEach(cost => cost.style.display = 'block');
}

window.Webflow?.push(async () => {
safeExecute(initInfiniteSlide);
safeExecute(initTestimonialsSwiper);
Expand All @@ -293,7 +314,8 @@ window.Webflow?.push(async () => {
safeExecute(initCarouselBannerSwiper);
safeExecute(initCaseSwiper);
safeExecute(animateZkevm);
safeExecute(initTab, "study");
safeExecute(initTab, "highlight");
safeExecute(initTab, "study", slideSwiper);
safeExecute(initTab, "highlight", slideSwiper);
safeExecute(initRotatingText);
safeExecute(initTab, "pricing", bilingCycle);
});
21 changes: 21 additions & 0 deletions src/styles/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,24 @@ a.inherit {
}

/* ANIMATE HERO LOGO SLIDE END */

.fusebox_plan.is-pricing-popular::before {
content: "";
position: absolute;
inset: -60px -20px;
background: radial-gradient(circle at center, #AFFAB6 0%, rgba(175, 250, 182, 0) 100%);
z-index: -2;
border-radius: inherit;
filter: blur(20px);
pointer-events: none;
}

.fusebox_plan.is-pricing-popular::after {
content: "";
position: absolute;
inset: 0;
background-color: #fff;
z-index: -1;
border-radius: inherit;
pointer-events: none;
}