How to prevent UIWebViewBounce, "rubber tape",

Using an ionic framework with Cordova CLI v3.4

I use the following settings in the config.xml file.

<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />

Compiling through the CLI and Xcode does not seem to fix anything.

Then I searched for the project DisallowOverscrollthroughout the project and made sure that all values ​​were set totrue

I still get rubber bands, though in my opinion. Anyone have an idea what could be the problem?

Thank!

+4
source share
2 answers

According to this post on the ionics forums :

"This is an ionic thing, not a cordova issue.

 <ion-content
         has-bouncing="false"
         start-y="55"
         padding="true"
         has-tabs="true"
         has-header="true"
         >

has-bouncing, ion-content

attr has-bouncing="false", , Cordova.

+12

HTML + JS, , HTML , WebView (, window.height JS). , preventDefault "touchmove" ( , , ).

, , jQuery... Q.addEventListener Q.removeEventListener ( jQuery).

function _touchScrollingHandler(event) {
    var p = event.target;
    var pos;
    var scrollable = null;
    do {
        if (!p.computedStyle) {
            continue;
        }
        var overflow = p.computedStyle().overflow;
        var hiddenHeight = p.scrollHeight - p.offsetHeight;
        var s = (['hidden', 'visible'].indexOf(overflow) < 0);
        if ((s || p.tagName === 'HTML') && hiddenHeight > 0) {
            if ((Q.Pointer.movement.positions.length == 1)
            && (pos = Q.Pointer.movement.positions[0])) {
                var sy = Q.Pointer.getY(event)
                    + Q.Pointer.scrollTop();
                if ((sy > pos.y && p.scrollTop == 0)
                || (sy < pos.y && p.scrollTop >= hiddenHeight)) {
                    continue;
                }
            }
            scrollable = p;
            break;
        }
    } while (p = p.parentNode);
    if (!scrollable) {
        Q.Pointer.preventDefault(event);
    }
}

var Q = {
    preventTouchScrolling: function () {
        Q.addEventListener(window, 'touchmove', _touchScrollingHandler);
    },
    restoreTouchScrolling: function () {
        Q.removeEventListener(window, 'touchmove', _touchScrollingHandler);
    }
};
0

Source: https://habr.com/ru/post/1538633/


All Articles