xxxxxxxxxx
//listen for window resize event
window.addEventListener('resize', function(event){
var newWidth = window.innerWidth;
var newHeight = window.innerHeight;
});
xxxxxxxxxx
window.onresize = function() {
if (window.innerHeight >= 820) { /* ... */ }
if (window.innerWidth <= 1280) { /* ... */ }
}
xxxxxxxxxx
addEventListener('resize', (event) => {});
onresize = (event) => {};
xxxxxxxxxx
1
2
3
$( window ).resize(function() {
$( "#log" ).append( "<div>Handler for .resize() called.</div>" );
});