innerHeight 和 innerWidth这两个方法分别是用来获取浏览器窗口的宽度和高度(包含滚动条的)var windowHeight = window.innerHeight console.log(windowHeight) var windowWidth = window.innerWidth console.log(windowWidth)