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'
// localStorage.setItem('language', 'zh-TW')
const savedLanguage = localStorage.getItem('language') || getBrowserLanguage()
const savedLanguage = 'en'
const i18n = createI18n({
legacy: false, // 使用 Composition API
locale: savedLanguage,

View File

@ -105,21 +105,13 @@ const handleWheel = (e) => {
const isInLastPanel = currentSection === 3;
// panel
if (isInLastPanel && lastPanel.scrollHeight > window.innerHeight) {
// panel
if (
(lastPanel.scrollTop === 0 && delta < 0) ||
(lastPanel.scrollTop + lastPanel.clientHeight >= lastPanel.scrollHeight &&
delta > 0)
) {
//
if (isInLastPanel) {
//
if (delta < 0 && lastPanel.scrollTop === 0) {
if (Math.abs(delta) > scrollThreshold) {
if (delta > 0 && currentSection < 3) {
goToSection(currentSection + 1);
} else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1);
}
goToSection(currentSection - 1);
}
e.preventDefault();
}
return; //
}
@ -131,6 +123,7 @@ const handleWheel = (e) => {
} else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1);
}
e.preventDefault();
}
};
@ -155,6 +148,9 @@ watch(
//
panels.forEach((panel, i) => {
//
if (i === 3) return;
ScrollTrigger.create({
trigger: panel,
start: "top center",
@ -170,6 +166,9 @@ watch(
//
panels.forEach((panel, i) => {
//
if (i === 3) return;
//
const bg = panel.querySelector(".parallax-bg");
if (bg) {
@ -414,264 +413,19 @@ watch(
},
});
//
ScrollTrigger.create({
trigger: panels[3],
start: "top 80%",
end: "bottom center",
onEnter: () => {
//
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"
);
},
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"
);
},
//
gsap.set(".content4", {
opacity: 1,
y: 0,
});
gsap.set([
".content4 > div:nth-child(1)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(3)",
".content4 .container .card"
], {
opacity: 1,
y: 0,
});
}, main.value);
}
@ -1086,14 +840,11 @@ watch(
// panel
&:last-child {
position: relative;
overflow-y: auto;
height: auto;
min-height: 100vh;
//
&::-webkit-scrollbar {
display: none; // Chrome, Safari, Opera
}
overflow-y: visible;
top: auto;
sticky: none;
}
&.first-panel {

View File

@ -105,21 +105,13 @@ const handleWheel = (e) => {
const isInLastPanel = currentSection === 3;
// panel
if (isInLastPanel && lastPanel.scrollHeight > window.innerHeight) {
// panel
if (
(lastPanel.scrollTop === 0 && delta < 0) ||
(lastPanel.scrollTop + lastPanel.clientHeight >= lastPanel.scrollHeight &&
delta > 0)
) {
//
if (isInLastPanel) {
//
if (delta < 0 && lastPanel.scrollTop === 0) {
if (Math.abs(delta) > scrollThreshold) {
if (delta > 0 && currentSection < 3) {
goToSection(currentSection + 1);
} else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1);
}
goToSection(currentSection - 1);
}
e.preventDefault();
}
return; //
}
@ -131,6 +123,7 @@ const handleWheel = (e) => {
} else if (delta < 0 && currentSection > 0) {
goToSection(currentSection - 1);
}
e.preventDefault();
}
};
@ -155,6 +148,9 @@ watch(
//
panels.forEach((panel, i) => {
//
if (i === 3) return;
ScrollTrigger.create({
trigger: panel,
start: "top center",
@ -170,6 +166,9 @@ watch(
//
panels.forEach((panel, i) => {
//
if (i === 3) return;
//
const bg = panel.querySelector(".parallax-bg");
if (bg) {
@ -414,264 +413,19 @@ watch(
},
});
//
ScrollTrigger.create({
trigger: panels[3],
start: "top 80%",
end: "bottom center",
onEnter: () => {
//
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"
);
},
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"
);
},
//
gsap.set(".content4", {
opacity: 1,
y: 0,
});
gsap.set([
".content4 > div:nth-child(1)",
".content4 > div:nth-child(2)",
".content4 > div:nth-child(3)",
".content4 .container .card"
], {
opacity: 1,
y: 0,
});
}, main.value);
}
@ -719,7 +473,7 @@ watch(
{{ t("home.scroll.tip") }}
</div>
<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[1]" />
<img class="carousel-img" :src="currentBannerImages[2]" />
@ -741,7 +495,7 @@ watch(
/>
</div>
<div class="content">
<div class="text-[#10253E] text-[54px] leading-[80px]">
<div class="text-[#10253E] text-[54px] leading-[80px]">
{{ t("home.section2.title1") }}
</div>
<div class="text-[#10253E] text-[54px] leading-[80px]">
@ -1086,14 +840,11 @@ watch(
// panel
&:last-child {
position: relative;
overflow-y: auto;
height: auto;
min-height: 100vh;
//
&::-webkit-scrollbar {
display: none; // Chrome, Safari, Opera
}
overflow-y: visible;
top: auto;
sticky: none;
}
&.first-panel {
@ -1115,8 +866,7 @@ watch(
.parallax-bg {
position: absolute;
top: -10%;
left: 0;
width: 100%;
height: 120%;
z-index: 1;