ใช้ window.outerWidth และ window.outerHeight เหตุการณ์ใน JavaScript เพื่อรับขนาดของหน้าต่างเมื่อมีการปรับขนาดเบราว์เซอร์
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อทำงานกับเหตุการณ์เพื่อตรวจสอบขนาดหน้าต่างเบราว์เซอร์ -
<!DOCTYPE html>
<html>
<head>
<script>
function resizeFunction() {
var val = "Window Width=" + window.outerWidth + ", Window Height="
+ window.outerHeight;
document.getElementById("test").innerHTML = val;
}
</script>
</head>
<body onresize = "resizeFunction()">
<p>Resize browser window and check the window (browser window)
height and width again.</p>
<p id = "test"> </p>
</body>
</html>