//窗口大小 var pageWidth = window.innerWidth, pageHeight = window.innerHeight; if(typeof pageWidth != "number"){ if(document.compatMode == "CSS1Compat"){ pageWidth = document.documentElement.clientWidth; pageHeight = document.documentElement.clientHeight; }else{ pageWidth = document.body.clientWidth; pageHeight = document.body.clientHeight; } } var pageHeight = document.documentElement.clientHeight; console.log("W:"+pageWidth+"|"+"H:"+pageHeight);
JavaScript获取窗口大小
最新推荐文章于 2021-06-08 10:51:42 发布