Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Setting a Div height to the window viewport size Re: Setting a Div height to the window viewport size

#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’});
}