JSFiddle - React, Tailwind, and code Playground

by asifrc

HTML

<div id="content">
    Content
</div>
<div id="footer">
    Footer
</div>

CSS

#content
{
    background-color: #AAAAAA;
    min-height: 300px;
}
#footer
{
    background-color: #AAAAFF;
    height: 100px;
}
.fixedBottom
{
    position: absolute;
    bottom: 0px;
}

JavaScript

$(document).ready(function() {
    var $foot = $('#footer').last();
    var height = $(window).height();
    var bottom = $foot.offset().top + $foot.height();
    console.log(height+','+bottom);
    if (bottom < height)
    {
        $foot.addClass('fixedBottom');
    }
});