I am facing an issue with a sticky sidebar that has a fixed height of calc(100vh-90px)
and the main content. The sidebar contains dynamic content, which may exceed its defined height, resulting in a scrollbar. On the other hand, the main content is lengthy. Is there a way to automatically scroll the sidebar to the bottom when the main content reaches the footer? While setting the sidebar's height: auto
resolves the issue, I would like it to have the exact screen height. Any suggestions on how to achieve this would be highly appreciated.
The basic HTML structure is as follows;
<nav></nav>
<div class="wrapper">
<div class="main"></div>
<div class="sidebar></div>
</div>
<footer/>
The CSS applied to the sidebar is;
position: sticky;
top: 90px;
height: calc(100vh-90px);
overflow-y: scroll;