How to disable bouncing in html5 fullscreen iphone app?

后端 未结 3 524
感动是毒
感动是毒 2021-01-02 21:44

I want to make html5 fullscreen app. I made a page and added it as an icon to my iphone. I added metatags:

 

        
相关标签:
3条回答
  • 2021-01-02 22:23

    If your using Cordova 1.7+, open the Cordova.plist file and set the key UIWebViewBounce to NO

    0 讨论(0)
  • 2021-01-02 22:33

    This will prevent scrolling on the whole page

    document.ontouchmove = function(e) {e.preventDefault()};
    

    In your case, where you want some divs to be scrollable, and some not to, you should be able to catch the event before it gets to the document

    scrollableDiv.ontouchmove = function(e) {e.stopPropagation()};
    
    0 讨论(0)
  • 2021-01-02 22:43

    Extending dmanxii's approach here is what we are doing.

        $("body").on("touchmove", function (event) {
            if ($(event.target).is(".WhatEverClass") || $(event.target).parentsUntil().is(".ParentClass")) {
                //console.log("NOT Disabled"); 
            }
            else {
                //console.log("Disabled"); 
                event.preventDefault();
            }
        });
    
    0 讨论(0)
提交回复
热议问题