Skip to content

Instantly share code, notes, and snippets.

@J5Dev
Created July 16, 2014 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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