1//listen for window resize event
2window.addEventListener('resize', function(event){
3 var newWidth = window.innerWidth;
4 var newHeight = window.innerHeight;
5});
1<p>Resize the browser window to fire the <code>resize</code> event.</p>
2<p>Window height: <span id="height"></span></p>
3<p>Window width: <span id="width"></span></p>