Home > jQuery > How to Get the Size of the Viewport Using jQuery
Bookmark and Share

How to Get the Size of the Viewport Using jQuery

Posted on March 31, 2018 | Filed in jQuery

Sometimes you will need to get the width and height of a window. To do that, you would use

jQuery(window).width();
jQuery(window).height();

This is useful on page load, if you wanted to check when a window was resized, you would use:

jQuery(window).resize(function() {
// Code here
});

Leave a Reply