Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
sobakaalkaidi

Pin not working with ScrollTrigger.scrollerProxy()

Recommended Posts

So I followed https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.scrollerProxy() guide and used smooth-scrollbar lib. Everything works except pinning. Maybe I doing something wrong? It just disappear when pinning starts.  

See the Pen eYJPWpe by sobakaalkaidi (@sobakaalkaidi) on CodePen

Share this post


Link to post
Share on other sites

Hey @sobakaalkaidi

 

You have that container there, so I think you need to direct the scrollerProxy to that container.

ScrollTrigger.scrollerProxy(container, {
  ...

 

Plus, you have to set the container as the scroller for the ScrollTriggers.

gsap.to('.pin', {
  scrollTrigger: {
    trigger: ".pin",
    scrub: true,
    markers: true,
    pin: true,
    // pinType: "transform",
    start: "top top",
    end: "+=1000px",
    scroller: container
  }
});

 

At least that got it working for me:

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

 

Cheers, Paul

  • Like 5

Share this post


Link to post
Share on other sites

Paul hit the nail on the head :) 

 

Side note pinType: "transform" is a .scrollerProxy() property, not a regular ScrollTrigger one.

  • Like 2

Share this post


Link to post
Share on other sites

You're welcome @sobakaalkaidi.

 

 

Another sidenote from me (smooth-scrollbar related - nothing to do with GSAP):

 

In your code I noticed, you are missing the 'd' in front of 'amping':

 

const scrollbar = Scrollbar.init(document.body, {amping: 0.05, delegateTo: document});

 

 

It is supposed to be damping, not amping. Like this:

const scrollbar = Scrollbar.init(document.body, {damping: 0.05, delegateTo: document});

 

 

 

  • Like 2

Share this post


Link to post
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.

×