Set div height to window height jquery


Source Code:

<script>
// get window height and width
var winWidth = $(window).width();
var winHeight = $(window).height();

// set div height and width
$('div').css({
	'width': winWidth,
	'height': winHeight,
});

// update height and width on window resize
$(window).resize(function(){
	$('div').css({
		'width': winWidth,
		'height': winHeight,
	});
});
</script>

Buy us coffee

Reviews and Comments