MDN似乎自相矛盾。以下是对文档的一些声明:
布局视图的定义:
The area within the innerHeight and innerWidth is generally considered the layout viewport.
布局视图属性:
When the user pinch-zooms the page, pops open a dynamic keyboard, or when a previously hidden address bar becomes visible, the visual viewport shrinks but the layout viewport is unchanged.
矛盾:
The viewport was originally 1200 x 800 (window.innerWidth; x window.innerHeight) pixels. Upon zooming in, the viewport became 800 x 533 pixels. This is the layout viewport.
所以,他们声称布局视窗的大小不能在缩放时改变。Window.innerWidth
是布局视窗的宽度。如果Window.innerWidth
是布局视口的宽度,而布局视口的大小不能改变,Window.innerWidth
的值如何在放大时改变?
手机上的缩放和桌面上的缩放是不一样的。通过捏手势完成的缩放不会改变页面布局。它按原样在页面上执行放大效果。