📌  相关文章
📜  window.onchange 大小 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:50.988000             🧑  作者: Mango

代码示例2
// Get current width and height (does not change the variables automatically)
let width = window.innerWidth;
let height = window.innerHeight;

// Updates the variables every time the window resizes
window.addEventListener("resize", function(event) {
  width = window.innerWidth;
  height = window.innerHeight;
});