DEV Community

Zhangwuji
Zhangwuji

Posted on

study develop mobile of h5

  1. why is layoutViewport?
   var layoutViewportWidth = document.documentElement.clientWidth;
Enter fullscreen mode Exit fullscreen mode

layoutViewportWidth is width of layoutViewport;OfCause you can regard is as the width of htmlElement;

2.window.screen.width is the device screen of width in logical pixel;

3.visualViewPort that you can regard it as eyes; if visualViewPort is big and will see more element;

   var visualViewportWidth = window.visualViewport.width;
   var scale = window.visualViewport.scale
Enter fullscreen mode Exit fullscreen mode

if scale == 1 ;visualViewportWidth equal the the width of brower in logical pixel;
4.

 var innerWidth = window.innerWidth;
Enter fullscreen mode Exit fullscreen mode

innerWidth is wdith of the biggest of element;

sunch as
Image description
even though the body is 985px but the div width the biggest width is in body; os the innerwidth is 1200px;

Top comments (0)