I have been trying to keep the left div and footer fixed in position while allowing the content of the right div to scroll accordingly on page scroll. In my case, I managed to fix the left div and footer, but the content inside the left div is not scrolling up or down as desired. Please refer to the attached image for a better understanding.
I want the sidebar to scroll along with the page scroll, without setting overflow-y: auto explicitly, and the footer should always remain fixed at the bottom of the page.
For further clarity, I am including a screenshot of my current implementation below.
#wrapper {
height: 100%;
overflow-x: hidden;
overflow-y: auto;
position: absolute;
width: 100%;
}
#sidebar-wrapper {
height: 100%;
padding: 0px;
position: fixed;
border-right: 1px solid #ddd;
z-index: 1000;
}
#sidebar {
position: relative;
height: 100%;
overflow-y: auto;
}
#main-wrapper {
height: 100%;
padding: 0px;
}
#main {
position: relative;
height: 100%;
padding: 0px;
}
#sidebar .list-group-item {
border-radius: 0;
border-left: 0;
border-right: 0;
border-top: 0;
}
.footer {
background-color: #ffffff;
bottom: 0;
position: fixed;
padding: 10px 0px;
border-top: 1px solid #ddd;
}
@media (max-width: 992px) {
body {
padding-top: 0px;
}
}
@media (min-width: 992px) {
#main-wrapper {
float: right;
}
}
@media (max-width: 992px) {
#main-wrapper {
padding-top: 0px;
}
}
@media (max-width: 992px) {
#sidebar-wrapper {
position: static;
height: auto;
/**
* To make this work
*/
max-height: calc(100vh - YOUR_FOOTER_HEIGHT);
border-right: 0;
}
}
...and so on...
Your feedback and suggestions based on the provided image are highly appreciated!