JSFiddle - React, Tailwind, and code Playground

HTML

<p class="normal"></p>

CSS

html, body{
height: 200%;
    background-color:#DEDEDE;
}

p {
width:100px;
height:100px;
background:red;
}

.scroll {
left:10px;
top:100px;
position:fixed;   
}

.normal {
position: absolute;
top: 190px;    
    left: 10px;
}

JavaScript

$(window).scroll(function() {
    if ($(window).scrollTop() > '200') {
     $("p").removeClass("normal");
     $("p").addClass("scroll");
    }
    if ($(window).scrollTop() < '200') {
     $("p").removeClass("scroll");
     $("p").addClass("normal");
    }
});