trigger change on window resize code example
Example 1: jquery window trigger resize
window.dispatchEvent(new Event('resize'));
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;