Phonegap vertical scroll

前端 未结 6 1383
你的背包
你的背包 2021-02-06 15:10

I am building a phonegap app for ios and have vertical scroll issue. There appears to be a few pixels scroll in the webview even without any content and this is affecting my abs

相关标签:
6条回答
  • 2021-02-06 15:47

    This solved it for me (on iOS at least - may have other compatibility things on other platforms)

    Try removing width=device-width, height=device-height from your meta at the top.

    It's an issue with the device not factoring for the status bar at the top as far as I can tell.

    0 讨论(0)
  • 2021-02-06 15:48

    For a latest answer (as of 2016), this solution was the most effective (smooth scrolling) for me in Cordova iOS.

    .element {
      overflow-y: scroll; /* has to be scroll, not auto */
      -webkit-overflow-scrolling: touch;
    }
    

    Source: https://css-tricks.com/snippets/css/momentum-scrolling-on-ios-overflow-elements/

    0 讨论(0)
  • 2021-02-06 15:59

    This might help:

    body {
        height: 100%;
        overflow: hidden;
    }
    
    0 讨论(0)
  • 2021-02-06 16:04

    Try hiding the System Tray, it did the trick for me.

    On MainPage.xaml, set "IsVisible" to false.

    shell:SystemTray.IsVisible="False" d:DesignHeight="768" d:DesignWidth="480"
    
    0 讨论(0)
  • 2021-02-06 16:07
    html, body {
        margin: 0;
        padding: 0;
        height: 100%;
        overflow: hidden;
    }
    
    <meta name="viewport" content="user-scalable=no, initial-scale=1, minimum-scale=1, width=device-width" />
    

    And in config.xml:

    <preference name="DisallowOverscroll" value="true" />
    

    Above are settings I found to be the best start for handling scroll on iOS. Then, just add 'overflow: auto' to any element you need to scroll. Use overthrow or iscroll to help support iOS < 5, android < 3, and and so on.

    0 讨论(0)
  • 2021-02-06 16:09

    None of above fixed my problem but below link. In my case, there was an excessive gap below the content which could not be explained and this gap was causing the scrollbar.

    Here is the link: https://github.com/phonegap/phonegap/wiki/Prevent-Scrolling

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