Created
October 25, 2012 15:41
-
-
Save etch-snippets/3953470 to your computer and use it in GitHub Desktop.
[jQuery] Set any 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
Now you can just use the css
height: 100vh