====== ResizeObserver ====== const resizeObserver = new ResizeObserver((entries) => { for (let entry of entries) { var msg = "good! "; if (entry.contentBoxSize) { msg += "boxSize:"; if (entry.contentBoxSize[0]) { msg += entry.contentBoxSize[0].inlineSize; msg += ":"; msg += entry.contentBoxSize[0].blockSize; } else { msg += entry.contentBoxSize.inlineSize; msg += ":"; msg += entry.contentBoxSize.blockSize; } msg += ":"; } else { msg += "rectSize:"; msg += entry.contentRect.width; msg += ":"; msg += entry.contentRect.height; msg += ":"; } msg += "body-width : " + $("body").width() + "; "; msg += "body-height : " + $("body").height() + "; "; msg += "main-width : " + $("main").width() + "; "; msg += "main-height : " + $("main").height() + "; "; $("#message").html(msg); } }); resizeObserver.observe(document.querySelector("#content"));