GSAP Fan Posted April 30, 2021 Share Posted April 30, 2021 Hi, first of all, please apologize my bad English. I'm new to gsap, so i'm learning this great tool I have created a horizontal ScrollTrigger, which shows images by scrolling side by side. This works great so far, but the overlay text "Beach" is scrolling also. The text should not scroll and should stay "fixed" and visible on the left, so its always visible. Can you help me? Thank you Greetings Jay See the Pen RwKzbmK by oi-developer (@oi-developer) on CodePen Link to comment Share on other sites More sharing options...
Solution mikel Posted April 30, 2021 Solution Share Posted April 30, 2021 Hey @GSAP Fan, Welcome to the GreenSock Forum. You could use a timeline and move both elements. gsap.timeline({ scrollTrigger: { trigger: galleryContainer, invalidateOnRefresh: true, pin: true, scrub: 1, end: () => "+=" + galleryContainer.offsetWidth } }) .to(galleryContainer, { x: () => -(galleryContainer.scrollWidth - document.documentElement.clientWidth) + "px", ease: "none", }) .to('.text', { x: () => (galleryContainer.scrollWidth - document.documentElement.clientWidth) + "px", ease: "none", },0) Happy scrolling ... Mikel 2 Link to comment Share on other sites More sharing options...
GSAP Fan Posted April 30, 2021 Author Share Posted April 30, 2021 Hey mikel. THANK YOU VERY VERY MUCH!!!!!!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now