JSFiddle - React, Tailwind, and code Playground

by orrinward

HTML

<div id="container">
    <div id="positioned_box">derp</div>
</div>

CSS

#container {
  background-color: #ccc; 
}

#positioned_box {
  width: 50px;
  height: 50px;
  padding: 30px;
  background-color: red;
  position: absolute;
}

JavaScript

function repositionBox() {
 $("#positioned_box").css({top: $(window).height() - $("#positioned_box").outerHeight() - 30, left: $(window).width() - $("#positioned_box").outerWidth() - 30});   
}


$(document).ready(function() {
   
    $("#container").css({height: $(window).height(), width: $(window).width()});
   
   repositionBox();
    
    
});


$(window).resize(function() {
    repositionBox();
});