Skip to content

Instantly share code, notes, and snippets.

@hlotvonen
Last active December 17, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlotvonen/5520586 to your computer and use it in GitHub Desktop.
Save hlotvonen/5520586 to your computer and use it in GitHub Desktop.
Snippet for a div to be 100% - 100px of browser window height
$(document).ready(function() {
// for a div to be 100% - 100px of browser window height
var windowheight = $(window).height();
var newheight = windowheight - 100;
$("#landing-section").height(newheight);
});
// with window resize
$(window).resize(function() {
var windowheight = $(window).height();
var newheight = windowheight - 100;
$("#landing-section").height(newheight);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment