Viewport vs Window Vs Document 视口 vs 窗口 vs 文档

18 浏览
0 Comments

Viewport vs Window Vs Document 视口 vs 窗口 vs 文档

在下面的代码中,

document.documentElement.clientWidth
   1349
document.documentElement.clientHeight
   363
window.innerWidth
   1366
window.innerHeight
   363
window.screen.height
   768
window.screen.width
   1366

因此,我的桌面屏幕宽度为1366像素,高度为768像素。

我学到了,

视口尺寸可以使用document.documentElement.clientWidthdocument.documentElement.clientHeight进行引用。

窗口尺寸可以使用window.innerWidthwindow.innerHeight进行引用。

1)视口和文档之间有什么区别?

2)什么时候调用window.onloaddocument.onload

0