How do I use jQuery to determine the size of the browser viewport, and to redetect this if the page is resized? I need to make an IFRAME size into this space (coming in a little on each margin).
For those who don't know, the browser viewport is not the size of the document/page. It is the visible size of your window before the scroll.
To get the width and height of the viewport:
var viewportWidth = $(window).width(); var viewportHeight = $(window).height();
resize event of the page:
$(window).resize(function() { });
2.1m questions
2.1m answers
60 comments
57.0k users