$(window).resize(function(evt) { const windowWidth = $(window).width(); const windowHeight = $(window).height(); console.log('Browser is now ' + windowWidth + ' x ' + windowHeight + ' pixels'); // Do more... });Ideally sizes should be in CSS units that automatically resize went the browser window resizes (eg vh, vw). But somethings javaScript is required.
Programming Tips - jQuery: react when the user resizes their browser window
Date: 2020jul6
Language: javaScript
Library: jQuery
Keywords: resize, grow, shrink, respond, responsive
Q. jQuery: react when the user resizes their browser window
A.