Jump to content


Problem with ScrollTrigger

Moderator Tag
Go to solution Solved by akapowl,

Recommended Posts

Hello !
I'm learning how to use ScrollTrigger but I'm having a problem creating a horizontal scroll. The width and height of my sections are present but no background-color is activated and no text is displayed. The code comes from the video: https://greensock.com/docs/v3/Plugins/ScrollTrigger

Thanks for your patience!

See the Pen QWZJymL by pseudoaupifcartropduratrouver (@pseudoaupifcartropduratrouver) on CodePen

Link to comment
Share on other sites

  • Solution

Hello Carl, welcome to the GSAP forum.


The main problem is that your CSS is not set up to align the sections beside one another.


So you'll want to have another look at the many many examples for fake-horizontal scenarios like that to see how you can get that done - e.g. using flex on your main-container and adjusting everything according to that properly, or alternatively using a display: inline/inline-block setup for your sections.


Here is your demo with the main container scaled down to showcase the issue causing your troubles (scroll down a bit to see the problem).


See the Pen mdzQmeg by akapowl (@akapowl) on CodePen



You can find some examples fake-horizontal setups here...




... and this here is one of my demos.


See the Pen dyvygmj by akapowl (@akapowl) on CodePen





Here is a rather basic Flex-Layout for your convenience - this one might be a bit easier to wrap your head around.


See the Pen RweqVKm by akapowl (@akapowl) on CodePen




  • Like 4
Link to comment
Share on other sites

Thank you for your response and the time you took to help me. I was indeed able to solve this problem by changing the style by putting a display flex and a width at 500% (100% * the number of sections). I have another question, what is the purpose of the start: "top top"?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.