在 JavaScript 中,當瀏覽器視窗調整大小時發生的事件是什麼?
在 JavaScript 中使用 window.outerWidth 和 window.outerHeight 事件以在瀏覽器調整大小時獲取視窗大小。
示例
你可以嘗試執行以下程式碼以處理事件以檢查瀏覽器視窗大小 −
<!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>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言程式設計
C++
C#
MongoDB
MySQL
JavaScript
PHP