Jump to content
Search Community

It is not possible to disable the pin with scrollTrigger's onEnterBack to prevent the display from shifting.

gsap-novice

Go to solution Solved by mvaneijgen,

Recommended Posts

Posted

I don't want it to execute just once, I want the pin to respond every time onEnter.
The display shakes when onEnterBack is used.

 

I want to fix this so that the screen doesn't shake when onEnter.

See the Pen OJewQJG by name-the-sans (@name-the-sans) on CodePen.

  • gsap-novice changed the title to It is not possible to disable the pin with scrollTrigger's onEnterBack to prevent the display from shifting.
Posted

Hi @gsap-novice welcome to the forum!

 

Can you maybe explain what it is you're trying to do and not what problem you're trying to solve. Disabling and enabling ScrollTriggers is a really advanced technique that you only need in really specific scenarios and from your code setup I'm not sure what it is you're trying to accomplish.

 

If I were to set this up all I would need is the following. Hope it helps and happy tweening! 

 

See the Pen ZEdjRQB by mvaneijgen (@mvaneijgen) on CodePen.

Posted

Hi @mvaneijgen thank you for your answer!

I have changed the contents of the codepen.

The link doesn't appear so I wrote it like this:

https://codepen.io/name-the-sans/pen/OJewQJG

 

What I want to achieve is the following.

- Set it so that it is not pinned when onEnterBack and onLeaveBack are triggered.

- Screen does not shake when onEnterBack is triggered.

  • Solution
Posted

I would then do something like this create a ScrollTrigger that pins your section and onLeave removes the ScrollTrigger then have another ScrollTrigger that watches for you to scroll back to some points (needs to be above the start of the pin ScrollTrigger) and then setups up the ScrollTrigger again. Hope it helps and happy tweening! 

 

See the Pen ZEdjRQB by mvaneijgen (@mvaneijgen) on CodePen.

  • Like 4
Posted

Thank you!!

Amazing! This is exactly what I wanted.

It was very helpful. I also learned new things I didn't know, such as the ScrollTrigger.defaults and markers options.

Thank you so much!

  • Like 1
Posted

Great!

 

Yep, I know it sound boring, but you should really read the docs. There is so much helpful content there, things you didn't even know you want https://gsap.com/docs/v3

  • Like 1
  • Thanks 1

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...