Skip to content

Instantly share code, notes, and snippets.

@RuslanAsadov
Created August 6, 2020 21:12
Show Gist options
  • Save RuslanAsadov/77fcd172aeb6fdfe44e362a61d780983 to your computer and use it in GitHub Desktop.
Save RuslanAsadov/77fcd172aeb6fdfe44e362a61d780983 to your computer and use it in GitHub Desktop.
small content JS
const contentHeight =
$('header')[0].offsetHeight +
$('main')[0].offsetHeight +
$('footer')[0].offsetHeight
if ($(window).height() > contentHeight) {
const toAdd = $(window).height() - contentHeight
const height = $('main')[0].offsetHeight + toAdd
$('main').css('height', height + 'px')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment