Jump to content
Search Community

scroll-smoother effects only works if resize window

Diego Gnoatto test
Moderator Tag

Recommended Posts

Hi there i got a problem with the nux3/scroll-smoother integration

info:

- im importing gsap and plugins trough script tags

the problem: everything seems working as is it but the data-speed and data-lag (effects) are correctly calculated and work only if you resize the browser.

live-preview

https://maikel-portfolio.netlify.app/

codesandbox-preview:

https://6cbc21-3000.preview.csb.app/

CodeSandBox:

https://codesandbox.io/p/github/Diego-Gnoatto/Maikel-portfolio/draft/trusting-germain

** the "smoothScroller init function is on the root in app.vue"

ps: never used codesandbox so it might be necessary to cd into the app folder and npm install before npm run dev 

 

seems that scrolltrigger isn't calculating properly the effects but on resize something is triggered that make it recalculate fine.

any tips of what could i be doing?

i tried blindelly all sorts of combinations of Scrolltrigger.refresh() and Scrolltrigger.refresh() thinking the problem could be solved by it but it did not 

 

Link to comment
Share on other sites

Sorry to hear about the trouble. Hm. Your CodeSandbox link didn't work at all - it said something about needing access to Github.

 

It's almost impossible to troubleshoot without a minimal demo - Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

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

 

If you're using something like React/Next/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 

 

It kinda sounds like you must be creating the ScrollSmoother BEFORE all your DOM elements exist (with the data attributes). Are you dynamically loading things in and creating the DOM elements after you created your ScrollSmoother? Keep in mind that you can dynamically add effects using smoother.effects()

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

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