您可以使用'window.screen'对象来获取屏幕的宽高。具体方法如下:

var screenWidth = window.screen.width; // 获取屏幕宽度
var screenHeight = window.screen.height; // 获取屏幕高度

console.log('屏幕宽度:' + screenWidth);
console.log('屏幕高度:' + screenHeight);

这样就可以分别获取到屏幕的宽度和高度。


原文地址: https://www.cveoy.top/t/topic/pmvt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录