html js resize code example
Example 1: resize js
window.addEventListener('resize', function(event){
// do stuff here
});
Example 2: resize js
const heightOutput = document.querySelector('#height');
const widthOutput = document.querySelector('#width');
function reportWindowSize() {
heightOutput.textContent = window.innerHeight;
widthOutput.textContent = window.innerWidth;
}
window.onresize = reportWindowSize;