Jump to content
GreenSock

Oleh_Rusyi

Scrollable area on a page with ScrollSmoother

Moderator Tag

Recommended Posts

Hi there. Can I have a scrollable container on a page that has ScrollSmoother initialized?
Scrolling inside such containers (that have overflow: auto ) translates to the whole page scroll.

Link to comment
Share on other sites

Currently normalizeScroll does not support nested scrollers, but it's something we're investigating. For now you'll just have to disable that feature.

 

ScrollSmoother.create({
            content: "#smooth-content",
            wrapper: "#smooth-wrapper",
            smooth: 1, // how long (in seconds) it takes to "catch up" to the native scroll position
            effects: false, // looks for data-speed and data-lag attributes on elements
            // normalizeScroll: true, // prevents address bar from showing/hiding on most devices, solves various other browser inconsistencies
            smoothTouch: 0,
        })

 

  • Like 1
Link to comment
Share on other sites

 Thank you. It's great that we have a smooth scroll feature in gsap, well done 👍 

Link to comment
Share on other sites

  • 10 months later...

Hi - this is still a bit of a sticking point for us, as the normaliseScroll function is so useful, disabling it because we have a scroller on the page seems to be un-optimal.

 

Is there a different workaround that we could explore?

Cheers

 

  • Like 1
Link to comment
Share on other sites

Sure, @intothebreach - have you tried setting allowNestedScroll: true in your config? 

ScrollTrigger.normalizeScroll({allowNestedScroll: true});

 

  • Thanks 1
Link to comment
Share on other sites

Thanks Jack! That works nicely, you're a star.

Out of interest is this in the docs at all? Couldn't find it myself.

Link to comment
Share on other sites

Sorry about the confusion there, @intothebreach - it was a "hidden" feature for a while. We were deciding if we should expose it in the API or not, but it has proven itself to be very useful so we're making it official now. It's in the docs. 👍

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