screen.width和screen.availwidth在javascript中的区别 [英] screen.width and screen.availwidth difference in javascript

查看:493
本文介绍了screen.width和screen.availwidth在javascript中的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaScript中的 screen.width screen.availwidth 有什么区别?

What is the difference between screen.width and screen.availwidth in JavaScript?

在我的系统上两者都是一样的!

On my system both are the same!

推荐答案

有些东西阻挡了你的一些视口,这样的历史/书签侧面板。这包括任务栏,除非它在Autohide上

Some things block some of your viewport, such a history/bookmarks side panel. This includes the taskbar, unless it's on Autohide

然后 window.screen.width!= window.screen.availWidth 。 :)

如果您要向视口绘图,则应使用 availWidth / availHeight 确定事物是否在视口之外等。请务必在窗口调整大小时重新计算,否则您将无法知道侧面板何时关闭。

If you are drawing things to the viewport, you ought to use availWidth / availHeight to determine if things are off the viewport etc. Be sure to recalculate on window resize otherwise you won't know when the sidepanel has been closed.


请注意,并非窗口本身可以使用此属性给出的所有宽度。当其他小部件占用窗口对象无法使用的空间时,window.screen.width和window.screen.availWidth存在差异。

Note that not all of the width given by this property may be available to the window itself. When other widgets occupy space that cannot be used by the window object, there is a difference in window.screen.width and window.screen.availWidth.

来源

这篇关于screen.width和screen.availwidth在javascript中的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆