JSFiddle - React, Tailwind, and code Playground

HTML

<div id="content">
    <div class="a100"></div>
</div>
<div id="slider">y</div>

CSS

#content {
    height:2000px;
    width: 50%;
    margin: auto;
    background: #ababab;
}
.a100 {
    height: 100px;
    width: 100%;
    border-bottom: solid #000 1px;
}
#slider {
    position:fixed;
    top: 10px;
    left: 0px;
    height: 100px;
    width: 200px;
    margin-left: -200px;
    background: red;
}

JavaScript

$(document).ready(function () {
    slider();
});

$(window).scroll(function () {
    slider();
});

function slider() {
    if (document.body.scrollTop > 100)
        $('#slider').stop().animate({"margin-left": '0'});
    else
        $('#slider').stop().animate({"margin-left": '-200'});
}