在 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