JSFiddle - React, Tailwind, and code Playground
HTML
<div id="header">Header</div>
<div id="content">Content</div>
<div id="footer">Footer</div>
JavaScript
var waitForFinalEvent = (function () {
/* http://stackoverflow.com/a/4541963/2034015 */
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
if (timers[uniqueId]) {
clearTimeout (timers[uniqueId]);
}
timers[uniqueId] = setTimeout(callback, ms);
};
})();
function adjustbody(){
var windowh = $(window).height();
var headerh = $("#header").height();
var footerh = $("#footer").height();
var contenth = windowh - headerh - footerh;
alert(windowh + "," + headerh + "," + footerh + "," + contenth);
$("#content").css("min-height",contenth);
}
$(document).ready(function(){
adjustbody();
$(window).resize(function () {
waitForFinalEvent(function(){
adjustbody();
}, 500, "some unique string");
});
});