Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Swaps the current fixed/absolute swap with position sticky. This is more efficient because we only update the offset once (except on parallax mode).
Moving the offset calculation outside of the intersection observer also has the benefit of positioning the background div on load rather than after the first scroll.
There's one breaking change though. In the current code when you reach progress 1 the background div will go off the screen. In my experience this is confusing and position sticky approach where the background div stays fixed until you finish scrolling over the container is what most people actually want. Also, most scrollys i've seen tend to run a full height div on the background, where this point is moot. Thoughts welcome, of course!
Closes #16.
before
top 0 and bottom 1
Grabacion.de.pantalla.2023-12-03.a.las.18.12.14.mov
top 0.5 and bottom 1
Grabacion.de.pantalla.2023-12-03.a.las.18.19.59.mov
after
top 0 and bottom 1
Grabacion.de.pantalla.2023-12-03.a.las.18.22.39.mov
top 0.5 and bottom 1
Grabacion.de.pantalla.2023-12-03.a.las.18.21.53.mov
top 0 and bottom 1 with full screen background
Grabacion.de.pantalla.2023-12-03.a.las.18.23.14.mov