Prevent Address-Bar hiding in mobile Browsers

前端 未结 7 1533
野趣味
野趣味 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:30

    if someone still has this problem with the hiding address bar, this is how its worked for me.

     html, body {
        height: 100%;
     }
    
     body {
        position: fixed;
        margin: 0;
        padding: 0;
        border: 0;
        outline: 0;
        background: 0 0;
            -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        overflow-y: scroll;
     }
    
     .background {
        position: fixed;
        background-image: url('...');
        background-repeat: no-repeat;
        background-size: cover;
        background-attachment: fixed;
        height: 100%;
        width: 100%;
        margin: 0;
        overflow: hidden;
     }
    

    I try a lot of similar code, but android chrome was killing me. Only this worked for me. When you have navigation at the bottom of the page it's major problem with that auto-hide bar.

提交回复
热议问题