Prevent Address-Bar hiding in mobile Browsers

前端 未结 7 1477
野趣味
野趣味 2020-11-30 04:20

I\'m currently working on a website with a horizontal layout. All elements are position:absolute with javascript. Their size is calculated with window.innerHeight. My Proble

7条回答
  •  攒了一身酷
    2020-11-30 04:42

    The only soltuion that worked for me was this :

    Put the content of your body inside a wrapper with the following style :

    
    .wrapper {
        position: absolute;
        top: 0.5px;
        left: 0;
        right: 0;
        bottom: 0.5px;
        overflow-x: hidden; /* or any other value */
        overflow-y: auto; /* or any other value */
    }
    
    

    the half-pixel offsets will be invisible but they will prevent the body from being considered as scrollable by the browser, thus preventing the address bar from hiding.

提交回复
热议问题