Html canvas contents for ios11 web browser cleared by scrolling page

The html page created using the canvas becomes different in ios11!

When it is first shown in a web view, the page looks great, but when it scrolls down and the canvas in it becomes invisible in the viewport, the content in the canvas disappears and never comes back when the page scrolls back.

Does anyone know how to fix this problem, or should I just wait until Apple installs it later?

+4
source share
1 answer

. , Safari Web Inspector - , . SO ( Webview iOS (10.3.1)).

, DOM. scrollstop, . touchmove , , , , .

$('#my-canvas').on({
    'scrollstop': function(e) {
        // e.scrollTop() doesn't work... so
        console.log($(window).scrollTop()); 
        if ($(window).scrollTop() === 0) {
           console.log("Redraw of the canvas");
           $('#my-canvas').hide().show(0);
        }
    }
});

, , iOS.

PS: , , -, WkWebView. , .

+1

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


All Articles