JSFiddle - React, Tailwind, and code Playground
HTML
<div class="c">
<div class="c1">Loading...</div>
<div class="c2">Button</div>
</div>
CSS
.c {
position: relative;
}
.c1 {
margin:100px auto;
width:100px;
text-align:center;
padding:5px 10px;
background: blue;
z-index: 1;
}
.c2 {
position:fixed;
text-align:center;
background:red;
z-index: 2;
cursor:pointer;
}
JavaScript
$(document).ready(function(){
$('.c2').each(function(){
$(this).css({
'width':$(this).siblings('.c1').outerWidth(),
'height':$(this).siblings('.c1').outerHeight(),
'top':$(this).siblings('.c1').offset().top,
'left':$(this).siblings('.c1').offset().left
});
});
$('.c2').on('click', function(){
$(this).hide(0);
});
});