I have this code:
function viewport() {
var height = $(window).height();
viewport = parseInt(height) + 'px';
$(".page").css('height',viewport);
$(".dot_page").css('height',viewport);
}
All it does is resize a div according to the viewport height. This happens once during the page load, but I would like it to update dynamically if the viewport is resized without reloading the page (someone just resizing their browser with their mouse).
Thank you
Use the resize event on the window object
You should also change your function because:
reassigns the viewport variable, which is initially the function to
with both of these, it should fix your problems.
The
resizeevent assignment should be in a$(document).readycall.With all your code, this looks like: