iOS 12 safari can not prevent pinch scale with "touchmove" eventlistener when scrolling

354 views Asked by At

I add this code

document.addEventListener('touchmove', function(event) {
    if (event.touches.length > 1) {
        event.preventDefault();
        event.stopPropagation();
    }
},
{
    passive: false
});

It worked when you don't move your page. But when you are scrolling the page and pinch scale the page at the same time, the page can still be scaling.

Is there any method to polyfill this situation?

1

There are 1 answers

1
Daniel Fabro On
const $body = document.querySelector('body');
$body.style.overflow = 'hidden';