JSFiddle - React, Tailwind, and code Playground
HTML
<div id="banner">BANNER</div>
<div id="content">
<div id="left">LEFT</div>
<div id="right">RIGHT</div>
</div>
<div id="footer">FOOTER</div>
CSS
#banner {
float: left;
width: 100%;
height: 100px;
background-color: #00ff00;
position: fixed;
}
#content {
height: auto;
}
#left {
float: left;
width: 30%;
height: 300px;
background-color: #ccc;
position: fixed;
margin-top: 100px;
}
#right {
float: right;
width: 70%;
height: 550px;
background-color: #333;
margin-top: 100px;
}
#footer {
clear: both;
width: 100%;
height: 100px;
background-color: #ff0000;
}
JavaScript
var scrollHeight;
$(window).ready(function() {
scrollHeight = $('#footer').offset().top - $('#left').height() - $('#left').offset().top;
});
$(window).scroll(function() {
if ($(document).scrollTop() >= scrollHeight) {
$('#left').css({
'position': 'relative',
'margin-top': '350px'
});
} else {
$('#left').css({
'position': 'fixed',
'margin-top': '100px'
});
}
});