How to prevent app running in phone-gap from scrolling vertically?

后端 未结 14 1789
伪装坚强ぢ
伪装坚强ぢ 2020-12-22 17:42

I\'m trying out phone gap and I want my application to not scroll up and down when the user drags their finger across the screen. This is my code. Can anyone tell me why it\

相关标签:
14条回答
  • 2020-12-22 18:11

    Run this code when the page is loaded to disable dragging:

    document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
    

    Here's an example with jQuery:

    $(document).ready(function() {
        document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
    });
    
    0 讨论(0)
  • 2020-12-22 18:12

    if you're using Cordova 2.3.0+ find config.xml and add this line:

    <preference name="UIWebViewBounce" value="false" />

    or in Cordova 2.6.0+:

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

    0 讨论(0)
  • 2020-12-22 18:16

    Add the following entry to config.xml file:

    <preference name="DisallowOverscroll" value="true" />
    
    0 讨论(0)
  • 2020-12-22 18:17

    now you just have to put <preference name="DisallowOverscroll" value="false" /> to <preference name="DisallowOverscroll" value="true" /> in your config.xml file.

    0 讨论(0)
  • 2020-12-22 18:19

    In config.xml of your project, under preferences for iOS set DisallowOverscroll to true.

    0 讨论(0)
  • 2020-12-22 18:22

    If you have UIWebViewBounce to NO in your .plist file.

    Then with simple css would make the content not scrollable. Try Adding this style overflow : hidden in your div where you want to disable the scroll.

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