Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I pass a value to a scene to update the progress? #38

Open
jjrchrds opened this issue Aug 15, 2021 · 2 comments
Open

Can I pass a value to a scene to update the progress? #38

jjrchrds opened this issue Aug 15, 2021 · 2 comments

Comments

@jjrchrds
Copy link

docs say I can set the progress of a scene, but can't seem to figure out how to to do it w react-scrollmagic

@andychoww
Copy link

solved?

@andosteinmetz
Copy link

I was also looking for this and couldn't find a way, at least not without forking the library.

An alternative method that worked for me is to:

  • set pinSettings={pushFollowers: false} on the <Scene>
  • follow the scene by a <div> element with style={{height: SCENE_DURATION, position: relative}}
  • then use anchor links within the <div> with absolute positioning and top styles that will place them at the correct position to update the progress where you want it to go.
  • Then, assign refs to the anchor links, and scroll to those links programatically as needed with
  • window.scrollTo(ref.current.getBoundingClientRect().top + window.scrollY)

A bit of a hack but, if you were motivated you could abstract this into a component of its own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants