JSFiddle - React, Tailwind, and code Playground

by Teuta Koraqi

HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="box"></div>
<div class="box-desc">Box bottom offset is:<div id="desc"></div></div>

CSS

.box {
  background: lightblue;
  width: 140px;
  height: 140px;
  position: absolute;
  top: 300px;
  left: 30px;
}

JavaScript

$(document).ready(function(){
  var windowHeight = $(window).height();
  var boxHeight = $(".box").height();
  var boxTopOffset = $(".box").offset().top;
  var boxBottomOffset = windowHeight - boxHeight - boxTopOffset;
     $("#desc").html(boxBottomOffset);
})