As you can see here i have two sections which takes whole page. I want to detect while scrolling, if second section is visible by 20% and if so, then force it to smoothly scroll and lock that section so it takes whole space. And the same with other sections if add more.
(The smooth part i can do myself).
Anyone have idea how could i do something like that?
* {
margin: 0;
padding: 0;
}
#s1 {
height: 100vh;
background: red;
}
#s2 {
height: 100vh;
background: blue;
}
<section id="s1"></section>
<section id="s2"></section>