Jump to content
Search Community

Scroll trigger - Change content when scrolling on pinned element

_elizabeth test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hello everyone, I'm very new to gsap and I am trying to achieve a similar effect to this codepen: https://codepen.io/GreenSock/pen/XWzRraJ. However, I don't want the contents to repeat. I just want to scroll to the next element. Following the example in the code pen I added above, the content is pinning and changing on scroll, but it keeps repeating. I know there's something I'm missing; I don't know how to go about it. Also, the elements are not updated in the correct order. Any help will be appreciated

 

See the Pen LYXwQzy by leezee (@leezee) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @_elizabeth and welcome to the GreenSock forums!

 

Is not the same setup to mix Observer and ScrollTrigger. The example you linked from the GreenSock collection uses only Observer.

 

This example seems to do what you're trying to achieve:

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

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

if you want to make your demo work with minimal effort, just create a timeline with keyframes  and  hook them to scrolltrigger it won't be the same result as the demo since its created with observer but you can have really cool transitions with keyframes 

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