Skip to content

Instantly share code, notes, and snippets.

@craigmdennis
Created February 20, 2012 18:19
Show Gist options
  • Save craigmdennis/1870455 to your computer and use it in GitHub Desktop.
Save craigmdennis/1870455 to your computer and use it in GitHub Desktop.
Set the height of an element to the height of the window
$.fn.fullHeight = function( offset ){
// Check if offset specified
if (offset === '') {
// If it's not then set it to 0
offset = 0;
}
// Maintain chainability
return this.each( function(){
// Set the height minus the offset
$(this).css({
'height' : $(window).height() - offset
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment