This commit is contained in:
scout 2025-02-23 14:47:00 +08:00
parent 433c004e44
commit ea598e5d4b
3 changed files with 60 additions and 559 deletions

View File

@ -25,7 +25,7 @@ function getBrowserLanguage() {
// 获取存储的语言或浏览器语言 // 获取存储的语言或浏览器语言
// const savedLanguage = 'zh' // const savedLanguage = 'zh'
// localStorage.setItem('language', 'zh-TW') // localStorage.setItem('language', 'zh-TW')
const savedLanguage = localStorage.getItem('language') || getBrowserLanguage() const savedLanguage = 'en'
const i18n = createI18n({ const i18n = createI18n({
legacy: false, // 使用 Composition API legacy: false, // 使用 Composition API
locale: savedLanguage, locale: savedLanguage,

View File

@ -105,21 +105,13 @@ const handleWheel = (e) => {
const isInLastPanel = currentSection === 3; const isInLastPanel = currentSection === 3;
// panel // panel
if (isInLastPanel && lastPanel.scrollHeight > window.innerHeight) { if (isInLastPanel) {
// panel //
if ( if (delta < 0 && lastPanel.scrollTop === 0) {
(lastPanel.scrollTop === 0 && delta < 0) ||
(lastPanel.scrollTop + lastPanel.clientHeight >= lastPanel.scrollHeight &&
delta > 0)
) {
//
if (Math.abs(delta) > scrollThreshold) { if (Math.abs(delta) > scrollThreshold) {
if (delta > 0 && currentSection < 3) { goToSection(currentSection - 1);
goToSection(currentSection + 1);
} else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1);
}
} }
e.preventDefault();
} }
return; // return; //
} }
@ -131,6 +123,7 @@ const handleWheel = (e) => {
} else if (delta < 0 && currentSection > 0) { } else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1); goToSection(currentSection - 1);
} }
e.preventDefault();
} }
}; };
@ -155,6 +148,9 @@ watch(
// //
panels.forEach((panel, i) => { panels.forEach((panel, i) => {
//
if (i === 3) return;
ScrollTrigger.create({ ScrollTrigger.create({
trigger: panel, trigger: panel,
start: "top center", start: "top center",
@ -170,6 +166,9 @@ watch(
// //
panels.forEach((panel, i) => { panels.forEach((panel, i) => {
//
if (i === 3) return;
// //
const bg = panel.querySelector(".parallax-bg"); const bg = panel.querySelector(".parallax-bg");
if (bg) { if (bg) {
@ -414,264 +413,19 @@ watch(
}, },
}); });
// //
ScrollTrigger.create({ gsap.set(".content4", {
trigger: panels[3], opacity: 1,
start: "top 80%", y: 0,
end: "bottom center", });
onEnter: () => { gsap.set([
// ".content4 > div:nth-child(1)",
scrollDownVisible.value = false; ".content4 > div:nth-child(2)",
// ".content4 > div:nth-child(3)",
gsap.set(".content4", { ".content4 .container .card"
opacity: 1, ], {
y: 0, opacity: 1,
immediateRender: true, y: 0,
});
//
gsap.set(
[
".content4 > div:nth-child(1)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(3)",
],
{
opacity: 0,
y: 30,
immediateRender: true,
}
);
//
gsap.set(".content4 .container .card", {
opacity: 0,
y: 50,
immediateRender: true,
});
const tl = gsap.timeline({
defaults: {
duration: 0.6,
ease: "power2.out",
},
});
//
tl.to(".content4 > div:nth-child(1)", {
opacity: 1,
y: 0,
})
.to(
".content4 > div:nth-child(2)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
.to(
".content4 > div:nth-child(3)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
//
.to(
".content4 .container > div:first-child .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.2"
)
.to(
".content4 .container > .right .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > div:first-child .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > .right .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
);
},
onLeave: () => {
//
scrollDownVisible.value = true;
gsap
.timeline({
defaults: {
duration: 0.4,
ease: "power2.in",
},
})
.to(".content4 .container .card", {
opacity: 0,
y: -30,
stagger: {
each: 0.1,
from: "end",
},
})
.to(
[
".content4 > div:nth-child(3)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(1)",
],
{
opacity: 0,
y: -30,
stagger: 0.1,
},
"-=0.3"
);
},
onEnterBack: () => {
//
scrollDownVisible.value = false;
gsap.set(".content4", {
opacity: 1,
y: 0,
immediateRender: true,
});
gsap.set(
[
".content4 > div:nth-child(1)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(3)",
],
{
opacity: 0,
y: -30,
immediateRender: true,
}
);
gsap.set(".content4 .container .card", {
opacity: 0,
y: -50,
immediateRender: true,
});
const tl = gsap.timeline({
defaults: {
duration: 0.6,
ease: "power2.out",
},
});
tl.to(".content4 > div:nth-child(1)", {
opacity: 1,
y: 0,
})
.to(
".content4 > div:nth-child(2)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
.to(
".content4 > div:nth-child(3)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
.to(
".content4 .container > div:first-child .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.2"
)
.to(
".content4 .container > .right .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > div:first-child .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > .right .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
);
},
onLeaveBack: () => {
//
scrollDownVisible.value = true;
gsap
.timeline({
defaults: {
duration: 0.4,
ease: "power2.in",
},
})
.to(".content4 .container .card", {
opacity: 0,
y: 30,
stagger: {
each: 0.1,
from: "end",
},
})
.to(
[
".content4 > div:nth-child(3)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(1)",
],
{
opacity: 0,
y: 30,
stagger: 0.1,
},
"-=0.3"
);
},
}); });
}, main.value); }, main.value);
} }
@ -1086,14 +840,11 @@ watch(
// panel // panel
&:last-child { &:last-child {
position: relative; position: relative;
overflow-y: auto;
height: auto; height: auto;
min-height: 100vh; min-height: 100vh;
overflow-y: visible;
// top: auto;
&::-webkit-scrollbar { sticky: none;
display: none; // Chrome, Safari, Opera
}
} }
&.first-panel { &.first-panel {

View File

@ -105,21 +105,13 @@ const handleWheel = (e) => {
const isInLastPanel = currentSection === 3; const isInLastPanel = currentSection === 3;
// panel // panel
if (isInLastPanel && lastPanel.scrollHeight > window.innerHeight) { if (isInLastPanel) {
// panel //
if ( if (delta < 0 && lastPanel.scrollTop === 0) {
(lastPanel.scrollTop === 0 && delta < 0) ||
(lastPanel.scrollTop + lastPanel.clientHeight >= lastPanel.scrollHeight &&
delta > 0)
) {
//
if (Math.abs(delta) > scrollThreshold) { if (Math.abs(delta) > scrollThreshold) {
if (delta > 0 && currentSection < 3) { goToSection(currentSection - 1);
goToSection(currentSection + 1);
} else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1);
}
} }
e.preventDefault();
} }
return; // return; //
} }
@ -131,6 +123,7 @@ const handleWheel = (e) => {
} else if (delta < 0 && currentSection > 0) { } else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1); goToSection(currentSection - 1);
} }
e.preventDefault();
} }
}; };
@ -155,6 +148,9 @@ watch(
// //
panels.forEach((panel, i) => { panels.forEach((panel, i) => {
//
if (i === 3) return;
ScrollTrigger.create({ ScrollTrigger.create({
trigger: panel, trigger: panel,
start: "top center", start: "top center",
@ -170,6 +166,9 @@ watch(
// //
panels.forEach((panel, i) => { panels.forEach((panel, i) => {
//
if (i === 3) return;
// //
const bg = panel.querySelector(".parallax-bg"); const bg = panel.querySelector(".parallax-bg");
if (bg) { if (bg) {
@ -414,264 +413,19 @@ watch(
}, },
}); });
// //
ScrollTrigger.create({ gsap.set(".content4", {
trigger: panels[3], opacity: 1,
start: "top 80%", y: 0,
end: "bottom center", });
onEnter: () => { gsap.set([
// ".content4 > div:nth-child(1)",
scrollDownVisible.value = false; ".content4 > div:nth-child(2)",
// ".content4 > div:nth-child(3)",
gsap.set(".content4", { ".content4 .container .card"
opacity: 1, ], {
y: 0, opacity: 1,
immediateRender: true, y: 0,
});
//
gsap.set(
[
".content4 > div:nth-child(1)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(3)",
],
{
opacity: 0,
y: 30,
immediateRender: true,
}
);
//
gsap.set(".content4 .container .card", {
opacity: 0,
y: 50,
immediateRender: true,
});
const tl = gsap.timeline({
defaults: {
duration: 0.6,
ease: "power2.out",
},
});
//
tl.to(".content4 > div:nth-child(1)", {
opacity: 1,
y: 0,
})
.to(
".content4 > div:nth-child(2)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
.to(
".content4 > div:nth-child(3)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
//
.to(
".content4 .container > div:first-child .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.2"
)
.to(
".content4 .container > .right .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > div:first-child .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > .right .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
);
},
onLeave: () => {
//
scrollDownVisible.value = true;
gsap
.timeline({
defaults: {
duration: 0.4,
ease: "power2.in",
},
})
.to(".content4 .container .card", {
opacity: 0,
y: -30,
stagger: {
each: 0.1,
from: "end",
},
})
.to(
[
".content4 > div:nth-child(3)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(1)",
],
{
opacity: 0,
y: -30,
stagger: 0.1,
},
"-=0.3"
);
},
onEnterBack: () => {
//
scrollDownVisible.value = false;
gsap.set(".content4", {
opacity: 1,
y: 0,
immediateRender: true,
});
gsap.set(
[
".content4 > div:nth-child(1)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(3)",
],
{
opacity: 0,
y: -30,
immediateRender: true,
}
);
gsap.set(".content4 .container .card", {
opacity: 0,
y: -50,
immediateRender: true,
});
const tl = gsap.timeline({
defaults: {
duration: 0.6,
ease: "power2.out",
},
});
tl.to(".content4 > div:nth-child(1)", {
opacity: 1,
y: 0,
})
.to(
".content4 > div:nth-child(2)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
.to(
".content4 > div:nth-child(3)",
{
opacity: 1,
y: 0,
},
"-=0.4"
)
.to(
".content4 .container > div:first-child .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.2"
)
.to(
".content4 .container > .right .card:first-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > div:first-child .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
)
.to(
".content4 .container > .right .card:last-child",
{
opacity: 1,
y: 0,
duration: 0.8,
},
"-=0.6"
);
},
onLeaveBack: () => {
//
scrollDownVisible.value = true;
gsap
.timeline({
defaults: {
duration: 0.4,
ease: "power2.in",
},
})
.to(".content4 .container .card", {
opacity: 0,
y: 30,
stagger: {
each: 0.1,
from: "end",
},
})
.to(
[
".content4 > div:nth-child(3)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(1)",
],
{
opacity: 0,
y: 30,
stagger: 0.1,
},
"-=0.3"
);
},
}); });
}, main.value); }, main.value);
} }
@ -719,7 +473,7 @@ watch(
{{ t("home.scroll.tip") }} {{ t("home.scroll.tip") }}
</div> </div>
<section className="panel first-panel"> <section className="panel first-panel">
<n-carousel autoplay :interval="5000" class="no-hover"> <n-carousel autoplay :interval="5000" class="no-hover">
<img class="carousel-img" :src="currentBannerImages[0]" /> <img class="carousel-img" :src="currentBannerImages[0]" />
<img class="carousel-img" :src="currentBannerImages[1]" /> <img class="carousel-img" :src="currentBannerImages[1]" />
<img class="carousel-img" :src="currentBannerImages[2]" /> <img class="carousel-img" :src="currentBannerImages[2]" />
@ -741,7 +495,7 @@ watch(
/> />
</div> </div>
<div class="content"> <div class="content">
<div class="text-[#10253E] text-[54px] leading-[80px]"> <div class="text-[#10253E] text-[54px] leading-[80px]">
{{ t("home.section2.title1") }} {{ t("home.section2.title1") }}
</div> </div>
<div class="text-[#10253E] text-[54px] leading-[80px]"> <div class="text-[#10253E] text-[54px] leading-[80px]">
@ -1086,14 +840,11 @@ watch(
// panel // panel
&:last-child { &:last-child {
position: relative; position: relative;
overflow-y: auto;
height: auto; height: auto;
min-height: 100vh; min-height: 100vh;
overflow-y: visible;
// top: auto;
&::-webkit-scrollbar { sticky: none;
display: none; // Chrome, Safari, Opera
}
} }
&.first-panel { &.first-panel {
@ -1115,8 +866,7 @@ watch(
.parallax-bg { .parallax-bg {
position: absolute; position: absolute;
top: -10%;
left: 0;
width: 100%; width: 100%;
height: 120%; height: 120%;
z-index: 1; z-index: 1;