JSFiddle - React, Tailwind, and code Playground

HTML

<div class="fix">fixed content</div>
<div class="rel">relative content</div>

CSS

.fix{
    position:fixed;
    background-color: black;
    color: white;
    width: 100%;
    top: 0 ;
    left:0;
    padding:20px;
    box-sizing:border-box;
} 

.rel {
    position: relative;
    width: 2000px;
}

JavaScript

$(window).on('scroll', function(e) {
    var left = $(this).scrollLeft();
    $('.fix').css('left', -left);
});