Last active
January 4, 2016 03:19
-
-
Save quawn/8560674 to your computer and use it in GitHub Desktop.
JS: Div full Width/Height of viewport with jQuery
This file contains 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
// global vars | |
var winWidth = $(window).width(); | |
var winHeight = $(window).height(); | |
// set initial div height / width | |
$('div').css({ | |
'width': winWidth, | |
'height': winHeight, | |
}); | |
// make sure div stays full width/height on resize | |
$(window).resize(function(){ | |
$('div').css({ | |
'width': winWidth, | |
'height': winHeight, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment