JSFiddle - React, Tailwind, and code Playground

by Oleg Khobotov

HTML

<div class="wrap">
    <div class="content">&nbsp;</div>
    <div class="aside">&nbsp;</div>
</div>

CSS

.wrap{
    width: 600px;
    overflow: auto;
    }
    .content{
    float: left;
    width: 200px;
    height: 5000px;
    background-color: green;
    }
    .aside{
    float: left;
    width: 400px;
    height: 2000px;
    background-color: #222222;
    }

JavaScript

$(document).scroll(function() {
    if ($('.aside').height() > $(document).scrollTop()){
        $('.aside').show();
        $('.content').width(200);    
    } else{
        $('.aside').hide();
        $('.content').width(600);
    }   
});