Home › Forums › JavaScript › Setting a Div height to the window viewport size › Re: Setting a Div height to the window viewport size
October 31, 2012 at 11:31 am
#113037
Senff
Participant
I’m not sure if this is the proper way of doing it, but I always end up using this jQuery script:
$(document).ready(function(){
resizeDiv();
});
window.onresize = function(event) {
resizeDiv();
}
function resizeDiv() {
vpw = $(window).width();
vph = $(window).height();
$(‘#somediv’).css({‘height’: vph + ‘px’});
}