(Edit: the JS in the original post was included by a mistake - it's now deleted)
I have a horizontal scroll working perfectly fine.
The problem is that my slides are vertical scrollable (and this is all good bc there's a lot of content) which means when I scroll down to the bottom of slide 1 and then scrolls horizontally to slide 2 the viewport does snap to the left of slide 2 but the viewport stays at the bottom of the slide. I want the viewport to snap to the TOP of slide 2 as well.
I haven't been able to find a solution to this, and there only seem to be start, end and center as working values for scroll-snap-align which doesn't solve my problem.
Does anyone know a way around this?
See the codesnippet below.
#slidesContainer {
height: auto;
width: auto;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
position: relative;
overflow: scroll;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
}
#slides {
color: black;
width: 100%;
height: auto;
font-size: 100px;
position: static;
flex-grow: 0;
flex-shrink: 0;
scroll-snap-align: start;
scroll-snap-stop: always;
}
<div id="slidesContainer">
<div id="slides" style="background-color:blue;">Slide 1<br><br> Scroll down until there is no more text, then scroll right text text text text text text text text text text text text text </div>
<div id="slides" style="background-color:green;">Slide 2<br><br>This text is not visible unless you scroll back up - this is the problem.</div>
<div id="slides" style="background-color:yellow;">Slide 3<br><br></div>
</div>
Thanks a lot in advance.