m_web Posted October 11 Share Posted October 11 I have a horizontal scrolling website using this code: gsap.registerPlugin(ScrollTrigger); const section = gsap.utils.toArray('.horizontal .section'); function getWidth() { let width = 0; section.forEach(el => width += el.offsetWidth); return width - window.innerWidth; } gsap.to(section, { x: () => -getWidth(), scrollTrigger: { trigger: '.horizontal', pin: true, scrub: true, } }); The site has image sections, that we want to have a horizontal parallax effect, between text sections. I've tried integrating the codepen into our code but I cant get tit to work horizontally. See the Pen QWjjYEw by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
GSAP Helper Posted October 11 Share Posted October 11 What have you tried already? We love to see what you can come up with, that way we can see your thought process and thus better help you understand the tools! If you're new to GSAP check out this awesome getting started guide https://gsap.com/resources/get-started/ Here is a starter template which loads all the plugins See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen 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