如何在Javascript中检测页面的宽度和高度?

16 浏览
0 Comments

如何在Javascript中检测页面的宽度和高度?

这个问题已经有了答案

获取屏幕、当前网页和浏览器窗口的尺寸

我想在html/javascript中找些帮助,如何编写一个javascript代码来检测页面的宽度和高度,当它比我想要的尺寸小时,弹出一个警告提示“按Ctrl-进行调整”。(我知道如何编写该消息,只需要帮助检测页面大小)

谢谢!

admin 更改状态以发布 2023年5月24日
0
0 Comments

如果你想要 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

0
0 Comments

jQuery的快速代码片段:

if ($(document).height() < minHeight || $(document).width() < minWidth) {
    // call popup
}

minHeightminWidth 是您应该定义的变量。

0