JSFiddle - React, Tailwind, and code Playground

by m4rk89

HTML

<body><div id="fixed" class="div-fixed"></div>  <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>

CSS

.div-fixed {
    background-color:#999;
    width:100px;
    height:100px;
    position:fixed;
    top:10px;
    left:10px;
    }

JavaScript

var position = $("#fixed").offset();
$("#fixed").html(position.top);