JSFiddle - React, Tailwind, and code Playground
HTML
<div class="c">
<div class="a">
<!-- non-static div -->
</div>
<div class="b">
<!-- static div -->
</div>
</div>
CSS
div.a {
background-color: #eeeeee;
position: absolute;
height: 400px;
width: 400px;
}
div.b {
background-color: #dddddd;
position: fixed;
height: 200px;
left: 400px;
width: 400px;
}
div.c {
height: 2000px;
width: 1600px;
}
JavaScript
$(document).scroll(function(e) {
$('.b').css({
'left': 400 - $(document).scrollLeft()
});
});