ウィンドウサイズ(ブラウザウィンドウのサイズ)を決定します

ブラウザウィンドウのサイズを決定する方法は3つあります。
Internet Explorer、Chrome、Firefox、Opera、Safariの場合:

window.innerHeight - 浏览器窗口的内部高度(包括滚动条)
window.innerWidth - 浏览器窗口的内部宽度(包括滚动条)

Internet Explorer 8、7、6、5の場合:

document.documentElement.clientHeight
document.documentElement.clientWidth

または

document.body.clientHeight
document.body.clientWidth

実用的なJavaScriptソリューション(すべてのブラウザーをカバー):

例:

var w=window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;

var h=window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;

おすすめ

転載: blog.csdn.net/Serena_tz/article/details/114117805
おすすめ