Jump to content
Search Community

Gsap horizontal scroll with vertical and horizontal scroll

fmaillet test
Moderator Tag

Recommended Posts

Hi there, 

 

I'm pretty new with gsap (thanks for the amazing job you are doing) and I'm just doing a simple horizontal scroll gallery with the possibilities of scrolling vertical and horizontal.

 

https://codesandbox.io/s/thirsty-leaf-rstg36

 

I was wondering if my approach was good or absolutely not.

I also read the Observer library, and was wondering to know if it's a better approach ? 

Thanks for your answers !
Have a good day

Link to comment
Share on other sites

Yeah, I don't notice anything glaringly wrong except you're not passing in an empty Array to your useEffect() calls, so they'll get called on every render. And I'm not sure why you're doing that wheel event listener stuff. 

 

We don't typically have the bandwidth to provide free code reviews, but if you've got a particular GSAP-related question we'd be happy to help with that.

 

As for Observer, it serves a very different purpose than ScrollTrigger. Each tool can be useful in various situations, but it's not typically like you need to choose between them as competitors. Observer is just a low-level way to listen for scroll-like behaviors. 

 

Enjoy!

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