Jump to content
Search Community

ScrollTrigger outside ScrollSmoother not working properly

David Gourdet test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

Hello,

I'm trying to display a modal that scrolls horizontally when loaded. 
I took my inspiration from this pen : 

See the Pen wvxoGeG by GreenSock (@GreenSock) on CodePen

 

It works perfectly when ScrollSmoother is not involved, but as soon as I uncomment the lines (5 to 11) that enable ScrollSmoother, it doesn't work anymore and I don't have a clue about the reason why.
It seems that my ScrollTrigger is now related to the ScrollSmoother instance and I don't want that. 
Is there a method to detach my ScrollTrigger instance from the ScrollSmoother one?

Any guidance is much appreciated.

See the Pen XWyzKzN by deodat (@deodat) on CodePen

Link to comment
Share on other sites

  • Solution

Heya! The first and main thing to note is that ScrollSmoother's 'scroller' is the wrapper element and your trigger will need to be within that element in order to fire. As it's a fixed element you can't do that as the fixed elements need to be positioned outside of the scroller. Which you've done.
 

<body>
  <div id="smooth-wrapper">
    <div id="smooth-content">
      <!--- ALL YOUR CONTENT HERE --->
    </div>
  </div>
  <!-- position: fixed elements can go outside --->
</body>

But because of this you'll need to set things up differently. Here's a simple example of using the main scroller's minimum and maximum scroll values instead.

See the Pen ZEmxGXr?editors=0010 by GreenSock (@GreenSock) on CodePen



Hope this helps!
 

  • Thanks 1
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.
×
×
  • Create New...