Jump to content
Search Community

ScrollSmoother applied to a modal/overlay, not just paused?

Mattrudd test
Moderator Tag

Recommended Posts

Hi people, 

This may well not be workable - but I'll always wonder if I don't ask!

My site is using ScrollSmoother throughout. On one page there's a modal (which is a full-screen overlay) that has overflowing content.
I'd much rather have this modal content scroll as smoothly as the page content.

The Codepen example cribbed from the forum shows a modal with ScrollSmoother paused and overflow:auto allowing modal content scroll.

So I'm wondering - is it possible to apply ScrollSmoother to the modal as well? Maybe apply a second instance of ScrollSmoother to the modal, then kill this and unpause the main body instance?


Figured, as ScrollSmoother is based on ScrollTrigger, that it might just (like GSAP magic) require a fancy nested scroll type affair being hooked up!

Before hitting 'post' on this, dug a bit deeper still to see that ScrollSmoother sections is coming! So maybe a stop-gap fix?

Thanks as ever ☺️

 

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

Link to comment
Share on other sites

Sorry, @Mattrudd, but the way ScrollSmoother works would only be possible with the entire page. You can't apply it to individual elements. I think you'd have to do something entirely different for that, like add a wheel event listener, preventDefault() on those, and use the deltaY to manually update the .scrollTop, maybe with a gsap.quickTo() for tweening it. Just an idea. 

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