JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>
<span></span>

CSS

div {
    width: 300px;
    height: 5000px;
    background: red;
}
span {
    width: 50px;
    height: 50px;
    position: fixed;
    top: 100px;
    right: 50px;
    background: blue;
    display: none;
}

JavaScript

$(window).scroll(function() {
    if(window.pageYOffset > 900) {
        $("span").fadeIn();
    } else {
        $("span").fadeOut();
    }
});