如何在不使用jquery的情况下获取文档高度和宽度 [英] How to get document height and width without using jquery
本文介绍了如何在不使用jquery的情况下获取文档高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以纯 javascript 即不使用 jquery 。
我知道 $(文件).height()
和 $(文件).width()
,但是我希望在 javascript 中执行此操作。
How to get document height and width in pure javascript i.e without using jquery.
I know about $(document).height()
and $(document).width()
, but I want to do this in javascript.
我的意思是页面的高度和宽度。
I meant page's height and width.
推荐答案
var height = document.body.clientHeight;
var width = document.body.clientWidth;
检查:这篇文章以获得更好的解释。
Check: this article for better explanation.
这篇关于如何在不使用jquery的情况下获取文档高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文