JSFiddle - React, Tailwind, and code Playground

HTML

<div id="fixed">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
</div>
<div id="big">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
</div>

CSS

div {
  width:90%;
}
#big {
  height:200vh;
}

#fixed {  
position:fixed;
background:silver;
  height:5em;
  overflow-y:hidden; 
  text-align:right;
}

JavaScript

const fixed = document.querySelector('#fixed')

addEventListener("scroll", () => {
	console.log(scrollY)
  
  // comment the next line to see how smooth-scrolling should work
	fixed.scrollTop = scrollY
})

console.log("hu")