better parallax-bg

This commit is contained in:
2026-02-20 11:09:55 +01:00
parent 9e5b15d9de
commit 105aa05f2e
5 changed files with 57 additions and 14 deletions

View File

@@ -286,13 +286,24 @@ gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
});
ScrollSmoother.create({
smooth: 1, // how long (in seconds) it takes to "catch up" to the native scroll position
smooth: 3, // how long (in seconds) it takes to "catch up" to the native scroll position
effects: true, // looks for data-speed and data-lag attributes on elements
smoothTouch: 0.1, // much shorter smoothing time on touch devices (default is NO smoothing on touch devices)
wrapper: 'main[role="main"]',
content: 'main[role="main"]>.layout-content'
});
gsap.to('#parallax-bg', {
y: (i, target) => -(ScrollTrigger.maxScroll(window) * 1.2),
ease: "none",
scrollTrigger: {
trigger: 'main[role="main"] > .layout-content > .wrapper',
start: "top bottom",
end: "bottom top",
scrub: true,
invalidateOnRefresh: true
}
});