window.resize jquery code example
Example 1: jquery window trigger resize
window.dispatchEvent(new Event('resize'));
Example 2: resize js
window.addEventListener('resize', function(event){
// do stuff here
});
Example 3: 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;