I have a section where a left div is fixed and the right div is scrollable but the right div content scrolls even before the scroll top reach the section. I want the right div to scroll only when it reaches the top of the div or bottom of the div (when scrolled up from the bottom) but it scrolls whenever it wants(inconsistent - when I scroll fast, it starts scrolling in the middle of the section, etc).
When I scroll up or down really fast, it even skips this section but I want it to be never skipped.
try scrolling fast and slow. the scroll works whenever it wants:
Code:
.outer_div {
display: flex;
position: relative;
height: 600px;
overflow-y: scroll;
width: 100%;
}
.scroll-content-left {
position: sticky;
flex: 1 0 65%;
top: 0;
display: flex;
align-items: center;
justify-content: center;
}
.scroll-content-left>div {
height: 200px;
width: 400px;
background-color: black;
}
.scroll-content-right {
position: relative;
height: 100%;
right: 0;
flex: 1 0 35%;
}
<div style="height: 600px; background-color: blue;"></div>
<div class="outer_div">
<div class="scroll-content-left">
<div></div>
</div>
<div class="scroll-content-right">
<div>
text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>text<br>
</div>
</div>
</div>
<div style="height: 600px; background-color: yellow;"></div>