JSFiddle - React, Tailwind, and code Playground

HTML

<header>Click to make position: fixed;</header>
<div class="text">
This is text that will move up when the header becomes fixed.
</div>

CSS

body {
    margin: 0;
    padding: 0;
}

header {
    width: 100%;
    height: 100px;
    background-color: blue;
    color: white;
    text-align: center;
    cursor: pointer;
    top: 0;
}

div {
    margin-top: 200px;
    color: red;
    width: 100%;
    text-align: center;
}

JavaScript

$("header").on("click", function() {
	$(this).html("This is now position: fixed;").css("position", "fixed");
  $(".text").css("margin-top", "300px");
})