Skip to content

Instantly share code, notes, and snippets.

@raphaelchaib
Created August 1, 2013 16:30
Show Gist options
  • Select an option

  • Save raphaelchaib/6132990 to your computer and use it in GitHub Desktop.

Select an option

Save raphaelchaib/6132990 to your computer and use it in GitHub Desktop.
Javascript: Make #main's height go to footer and fill up all the page
// Make #main's height go to footer and fill up all the page
jQuery(document).ready(function() {
// Size that main have to be
var mainPredefinedHeight = jQuery(window).height()
- jQuery('#header').outerHeight(true)
- jQuery('#footer').outerHeight(true)
- parseInt(jQuery('#main').css('paddingBottom'))
;
if( jQuery('#main').height() < mainPredefinedHeight) {
jQuery('#main').height( mainPredefinedHeight )
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment