如何在Javascript中检测页面的宽度和高度?
如何在Javascript中检测页面的宽度和高度?
这个问题已经有了答案:
我想在html/javascript中找些帮助,如何编写一个javascript代码来检测页面的宽度和高度,当它比我想要的尺寸小时,弹出一个警告提示“按Ctrl-进行调整”。(我知道如何编写该消息,只需要帮助检测页面大小)
谢谢!
admin 更改状态以发布 2023年5月24日
如果你想要 Ctrl 键 - 那么就是想要浏览器高度和宽度以满足大屏幕需求,在按下 Ctrl 键 - 之后,请按以下步骤(获取宽度和高度的简单方法)
Press F12 - > Click on Console -> now right side under search option [in fire bug window] type window.innerWidth then select window.innerWidth and press run button which is exact under this window (bottom) and check in console [bottom] browser print window.innerWidth. Do same for get window.innerHeight