JavaScript 中浏览器窗口调整大小时发生的事件是什么?
htmljavascriptprogramming scripts更新于 2024/6/17 9:16:17
使用 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>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

