drop the footer if there is a gab between the bottem of the footer
(function() {
var footer = document.getElementById("footer");
var footer_stat = "normal";
var footer_anchor = document.getElementById("footer_anchor");
function footer_drop() {
footer_h = footer.clientHeight;
var rect = footer_anchor.getBoundingClientRect();
footer_offset = rect.top;
min_ofset = window.innerHeight - footer_h;
if (window.innerHeight <= $(window).height()) {
if (min_ofset > footer_offset) {
if (footer_stat === "normal") {
footer.style.position = "fixed";
footer.style.bottom = "0";
footer.style.width = "100%";
footer_stat = "fixed";
}
} else {
if (footer_stat === "fixed") {
footer.style.position = "static";
footer_stat = "normal";
}
}
}
}
$( window ).on('load', function() {
footer_drop();
});
$( window ).resize(function() {
console.log("test");
footer_drop();
});
})();