Skip to content

Instantly share code, notes, and snippets.

@nathanaelphilip
Created July 1, 2014 18:10
Show Gist options
  • Save nathanaelphilip/4eab44d15f8d22e8c227 to your computer and use it in GitHub Desktop.
Save nathanaelphilip/4eab44d15f8d22e8c227 to your computer and use it in GitHub Desktop.
Resize Height
var headerHeight = $('#primary-navigation').outerHeight();
var footerHeight = $('#main-footer').outerHeight();
var $jsheight = $('.js-height');
if ($jsheight.data('sub')) {
$jsheight.height($(window).height() - headerHeight - $($jsheight.data('sub')).outerHeight() * 2.2);
}else{
$jsheight.height($(window).height() - headerHeight);
}
$(window).on('resize',function(){
headerHeight = $('#primary-navigation').outerHeight();
footerHeight = $('#main-footer').outerHeight();
$('.js-height').height($(window).height() - headerHeight);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment