Jump to content
Search Community

Want to achieve same functionality based on scroll event

akrdesign test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

  • Solution

Have you seen the Observer plugin https://gsap.com/docs/v3/Plugins/Observer/ with it you can watch for scroll events (and all other kind of events), so I've wrapped your animation code in a function and on click or on scroll it now calls next(), as you can see you could also implement a previous() function and have it work the other way round. Hope it helps and happy tweening! 

 

See the Pen VwRozae?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

 

Side note: you probably also want to page to scroll normally at some point,  so here an example that mixes normal scroll with the Observer plugin

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

  • Like 1
  • 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...