Skip to content

Question about progress #35

Answered by ffdead
mokargas asked this question in Q&A
Feb 25, 2024 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

Hi @mokargas

You are correct in your thinking that scrollState is relative to the component you are tracking.

Indeed progress is 0 when the DOM element enters the viewport at the bottom of the screen, and 1 when it exists the viewport at the top of the screen.

Your confusion comes from the fact that the hero is already in the viewport when the page loads, hence the progress is already started. You can figure out your starting value based on the height and remap the progress.

Your container is 400vh - each section is 100vh. The container actually has to travel 500vh to enter and fully exit the viewport (after 400vh the last section is still inside the viewport).

0 - No part of the containe…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@mokargas
Comment options

@ffdead
Comment options

@mokargas
Comment options

Answer selected by ffdead
Comment options

You must be logged in to vote
1 reply
@ffdead
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants