获取不包括水平滚动条的视口高度? [英] Get viewport height excluding horizontal scrollbar?

查看:39
本文介绍了获取不包括水平滚动条的视口高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

window.innerHeight 给出视口的高度包括水平滚动条的高度.有没有办法找到可用内部高度,即包括水平滚动条?

理想情况下,我正在寻找纯 JS 解决方案,但如果没有,jQuery 等也很好.

解决方案

如果我告诉你它比你想象的(或者比你当时想象的要容易)怎么办document.body.clientWidth;>

window.innerHeight gives the height of the viewport including the height of the horizontal scrollbar. Is there a way to find the usable inner-height, i.e. one which does not include the horizontal scrollbar?

I am ideally looking for a pure JS solution, but if there isn't one, jQuery etc is fine too.

解决方案

What if I told you it's easier than you think (or than you thought back then) document.body.clientWidth;

这篇关于获取不包括水平滚动条的视口高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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