I'm trying to have a web page scroll and snap to beginning of some elements as the user scrolls through a webpage using scroll-snap-type: y mandatory
and scroll-snap-align: start
. My problem is that it's a large webpage and unlike many samples where the whole page is just a div and children, I've got many divs and children. If I restrict my divs' direct container to have 100vh the scroll snapping works but there is double scrollable content problem: the document scrolls and the inner div's snapping content scrolls independently of the whole document. If I don't restrict the direct parent's height then snapping doesn't work.
Here is an example: https://codepen.io/canp/pen/abGJKXX
Basically the example in the above link does snap but there is the double scroll problem. I want the outer
class div the only scrolling component, while still snapping to mid
's children page
divs without double scrollbars.
How can I make document scrolling to snap to a grand-grandchild's start position?