Skip to content

Instantly share code, notes, and snippets.

@J5Dev
Created July 16, 2014 18:19
Show Gist options
  • Save J5Dev/7ed5d07ecb8c01bdad6c to your computer and use it in GitHub Desktop.
Save J5Dev/7ed5d07ecb8c01bdad6c to your computer and use it in GitHub Desktop.
jQueryFooterSticker - Works on browser resize without any css markup required
$(window).resize(function () {
var footer = $("footer");
var pos = footer.position();
var height = $(window).height();
height = height - pos.top;
height = height - footer.outerHeight();
if (height > 0) {
footer.css({
'margin-top': height + 'px'
});
}
}).resize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment