Sometimes you need to change something depending on the browser size. Often this means that you’ll need to check for the browser being resized too… To do this you use:
window.onresize = nameOfAFunction;
For an example, make sure you have a <div> with an id of ‘footer’, with a <p> tag inside and try the following:
function checkPageDims(){
var pageW = $(window).width();
var pageH = $(window).height();
$('#footer p').html('w:'+pageW+', h:'+pageH);
}
Then below type:
window.onresize = checkPageDims;
Main Category
Secondary Categories