Created
February 20, 2012 18:19
-
-
Save craigmdennis/1870455 to your computer and use it in GitHub Desktop.
Set the height of an element to the height of the window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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