JSFiddle - React, Tailwind, and code Playground

HTML

<div id="image">Some image</div>
<div id="scroller">Some controls</div>

CSS

body {
    height: 3000px;
    top: 0;
    
}
#image {
    width: 100%;
    background: #444;
    height: 50px;
}
#scroller{
    height:100px;
    background:#ccc;
}
.stuck{
    position:fixed;
    z-index:100;
    width:100%;
    top:0;
}

JavaScript

$(window).scroll(function() {
				if ($(window).scrollTop() > 50) {
					$('#scroller').addClass('stuck');
				} else {
					$('#scroller').removeClass('stuck');
				}
    
			});