JSFiddle - React, Tailwind, and code Playground

HTML

<div class="search">Search</div>

CSS

body {
  height: 1000px;
  
}
.search {
  width: 200px;
  height: 50px;
  background-color: red;
  position: absolute;
  top: 90px;
}

JavaScript

$(window).scroll(function(){
     $.each($('.search'),function(){
         var windowpos = $(window).scrollTop();
         var finaldestination = windowpos+90; 
         $(this).stop().animate({'top':finaldestination},300);
     });
});