宽度:window.innerWidth

高度:window.innerHeight

以上是遵循W3C的标准来获取,但是这在IE9版本下的浏览器中却返回undefined。

解决方法:

宽度:document.documentElement.clientWidth

高度:document.documentElement.clientHeight

这是非标准但却得到了很好的浏览器支持。

相关文章:

  • 2022-02-07
  • 2021-09-03
  • 2021-12-05
  • 2021-07-27
  • 2022-12-23
  • 2021-10-20
  • 2021-11-25
  • 2022-12-23
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2021-11-27
  • 2021-06-14
  • 2022-02-19
相关资源
相似解决方案