爱特介绍页初稿

This commit is contained in:
2026-02-12 23:33:46 +08:00
parent 8b105e37eb
commit d4483f204e
4 changed files with 665 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
(() => {
const steps = document.querySelectorAll('.intro-step');
if (!steps.length) return;
const markActive = () => {
const vh = window.innerHeight;
steps.forEach((step) => {
const rect = step.getBoundingClientRect();
const isActive = rect.top < vh * 0.8 && rect.bottom > vh * 0.2;
step.classList.toggle('is-active', isActive);
});
};
markActive();
document.body.classList.add('has-intro-animations');
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
entry.target.classList.toggle('is-active', entry.isIntersecting);
});
},
{
threshold: 0.35,
rootMargin: '0px 0px -15% 0px',
}
);
steps.forEach((step) => observer.observe(step));
window.addEventListener('resize', markActive);
})();