Skip to content

Instantly share code, notes, and snippets.

@pygeek
Created December 19, 2012 17:01
Show Gist options
  • Save pygeek/4338297 to your computer and use it in GitHub Desktop.
Save pygeek/4338297 to your computer and use it in GitHub Desktop.
stick footer to bottom of page regardless of (window height : content height)
$(function(){
var $footer_position = function(){
if($(document).height() <= $(window).height()){
$('footer').css({'position' : 'absolute',
'bottom' : '0px'
})
}else{
$('footer').css({'position' : 'static'})
}
};
$(window).resize(function(){ $footer_position()})
$footer_position()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment