jquery window resize code example
Example 1: check window resize javascript
window.addEventListener("resize", () => {
// CODE
});
Example 2: jquery window trigger resize
window.dispatchEvent(new Event('resize'));
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;