screen.width 找到正确尺寸的问题

问题描述

我无法让 screen.width 更改为其视口的宽度。我已经尝试了很多显示屏幕尺寸的平台,但都没有奏效。

<h1 id="heading"></h1>
<style>
//Checking for mobile device
var mobile;
if (screen.width < 1000) {
  mobile = 1;
} else {
  mobile = 0;
}
//heading
var h1 = document.getElementById("h1");
h1.innerHTML = "Herbon Drone Services";
if (mobile === 1) {
  h1.style.fontSize = "20px";
} else {
  h1.style.fontSize = "60px";
}
</style>

还有你如何获得声誉。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)