I have a parent and child divs that are both scrollable. The parent div has a fixed height. The child div has a dynamic height and it scrollable depending on its content.
How can I achieve seamless controlling when the child element has very long content? The problem is that if the parent scroll is at the very top, the scroll of the child element cannot scroll further down unless the mouse moves a bit to have focus on the parent so that the scroll continues.
UPDATE
My answer below does not take into account that for some use cases the child element does not have to be 100% width of the parent element.
The code is below.
.outer {
width: 400px;
background-color: antiquewhite;
height: 400px;
overflow-y: scroll;
}
h2 {
margin-bottom: 500px;
}
.inner {
height: 800px;
width: 80%;
overflow-y: scroll;
background-color: aquamarine;
}
<div class="outer">
<div class="inner">
<h2>sddssd</h2>
<h2>sddssd</h2>
<h2>sddssd</h2>
<h2>sddssd</h2>
</div>
</div>