maciekgrzybek / svelte-inview

A Svelte action that monitors an element enters or leaves the viewport.🔥
MIT License
749 stars 23 forks source link

Scrollspy Demo? #20

Closed oneezy closed 2 years ago

oneezy commented 2 years ago

Is there a srollspy demo up anywhere? I'm trying to create something like this but having a little bit of trouble with it https://codepen.io/oneezy/pen/ZErggwO

maciekgrzybek commented 2 years ago

Not yet, but that's a good idea. I'll recreate it for you :)

maciekgrzybek commented 2 years ago

I think this is what your looking for? https://codesandbox.io/s/svelte-scroll-spy-svsxz8?file=/Content.svelte

oneezy commented 2 years ago

thanks @maciekgrzybek ! that's exactly what i was looking for. I made one slight adjustment to the section height so it would be more fluid. for some reason your demo wasn't working as expected (see video below)

Code Demo w/ Height Adjustment https://codesandbox.io/s/svelte-scroll-spy-forked-bwujmh?file=/Content.svelte:240-258

Video Demo (yours 0:00-0:11) ... (mine 0:12-0:24)

https://user-images.githubusercontent.com/7369575/175831328-01fca8a0-5ebe-48bc-9d50-75ceb9bb6a96.mp4

oneezy commented 2 years ago

I went ahead and put together another demo from your example today. Just leaving this here for anyone else that might need something similar

https://svelte.dev/repl/898c9b36a0f54db39530b54875492cf3?version=3.48.0