Stopping overscroll / bounce in Phonegap IOS

前端 未结 20 1447
青春惊慌失措
青春惊慌失措 2020-12-07 18:53

I am using the latest version of Phonegap on IOS (ipad) and I can\'t seem to disable the vertical overscroll/bounce on the whole app. I don\'t mind it on inner elements but

相关标签:
20条回答
  • 2020-12-07 19:10

    Use this way:-

    function disallowOverscroll(){
      $(document).on('touchmove',function(e){
        e.preventDefault();
      });
      $('body').on('touchstart','.scrollable',function(e) {
        if (e.currentTarget.scrollTop === 0) {
          e.currentTarget.scrollTop = 1;
        } else if (e.currentTarget.scrollHeight
                  === e.currentTarget.scrollTop
                      + e.currentTarget.offsetHeight) {
          e.currentTarget.scrollTop -= 1;
        }
      });
      $('body').on('touchmove','.scrollable',function(e) {
        e.stopPropagation();
      });
    }
    disallowOverscroll();
    

    For more details or Tips & Tricks, please read this article click

    0 讨论(0)
  • 2020-12-07 19:10

    I had a similar issue, but couldn't fix it with all solutions I found so far (like editing config.xml).

    But finally, simply editing the body's CSS property then it fixed:

    html,body
    {
      overflow: auto;
      height:100%;
    }
    
    0 讨论(0)
  • 2020-12-07 19:12

    You have to modify a property in your config.xml file. Just set the following preference to true

    <preference name="DisallowOverscroll" value="true" />
    
    0 讨论(0)
  • 2020-12-07 19:13

    If you're adding <preference name="DisallowOverscroll" value="true"/> to config.xml without any luck, you may be changing the wrong file. Instead, search the entire phonegap directory for "DisallowOverscroll." You should find several instances. Change those to true.

    Cheers.

    0 讨论(0)
  • 2020-12-07 19:13

    Use this:

    <preference name="UIWebViewBounce" value="false" />
    
    0 讨论(0)
  • 2020-12-07 19:14

    After update the the config.xml I had not luck, if that is your case try this.

    For iOS works on iPhone + iOS 11, on CDVThemeableBrowser.m file, set property as YES:

    self.disallowoverscroll = YES;
    
    0 讨论(0)
提交回复
热议问题