svelte-society / recipes-mvp

this repo has been archived - pls head to https://github.com/svelte-society/sveltesociety.dev/tree/master/src/pages/recipes to contribute recipes!
https://github.com/svelte-society/sveltesociety.dev/tree/master/src/pages/recipes
MIT License
289 stars 18 forks source link

[Recipe] action or something else that reacts when a component scrolls into view #55

Open swyxio opened 4 years ago

swyxio commented 4 years ago

Proposed Recipe

as above

might want to use https://github.com/russellgoldenberg/enter-view/blob/master/enter-view.js

might want to recreate this with svelte https://pudding.cool/process/scrollytelling-sticky/

or @kevmodrome might have something already

babycourageous commented 4 years ago

Perhaps something like this?

https://svelte.dev/repl/9a6087b0b661445ead0b45c0c15d273a?version=3.23.2

Don't know enough to know if sticking with using scroll or changing to intersection observer is best

swyxio commented 4 years ago

oh cool! i think threshold maybe a bit too manual, we need to dynamically figure out the position of the element and make it sensitive to resize. i think thats what enter-view.js does if u look at it.