Disable hiding of address bar on mobile

前端 未结 3 1687
广开言路
广开言路 2021-02-03 14:04

I\'m working on a mobile website which has \"pages\" that have div\'s which take up the screens full size and you can scroll between each one. The problem is, the window resizes

相关标签:
3条回答
  • 2021-02-03 14:49

    You can wrap your HTML with div and do something like this: http://jsfiddle.net/DerekL/Fhe2x/show

    $("html, body, #wrapper").css({
        height: $(window).height()
    });
    

    It works on Android and iOS.

    0 讨论(0)
  • 2021-02-03 14:54

    The simplest way to achieve this is to scroll in a container, rather than scrolling the document.

    E.g.:

    <html><body>
      <div id="scrollable-content"> ... all your content here ... </div>
    </body></html>
    
    html, body {
      height: 100%;
    }
    
    #scrollable-content {
      height: 100%;
      overflow-y: scroll;
    }
    
    0 讨论(0)
  • 2021-02-03 14:58

    Are you looking at iPhone? I don't know about Android, but on iOS 7 for iPhone it's not possible. One thing you could do is use minimal-ui to have an always-minimized navigation bar, keeping a consistent size for the window:

    <meta name="viewport" content="width=device-width, minimal-ui">

    http://visuellegedanken.de/2014-03-13/viewport-meta-tag-minimal-ui/

    I hope that helps!

    0 讨论(0)
提交回复
热议问题