Created
March 13, 2012 07:22
-
-
Save ardysnippets/2027408 to your computer and use it in GitHub Desktop.
JavaScript: Auto-adjust footer position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Global JS file | |
*/ | |
$(function() { | |
// adjust the footer position | |
setInterval(function(){ | |
var footer = '.footer'; | |
var resize = $('.container').height() + $(footer).height() > $(window).height(); | |
$(footer).css({"position": resize ? "static" : "fixed"}); | |
$('body').css({"height":($(document).height() - $(footer).height()) + "px"}); | |
}, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment