Skip to content Skip to sidebar Skip to footer

Disable Double Tap Zoom/resize On Safari Ios12***

I search 99% website on internet... nope answer can solve my problem..i am using ios 12... does any jQuery can totally disable safari double tap now??? or can I have some code dete

Solution 1:

Adding an empty click listener on HTML elements will prevent double tap zoom.

It's ugly but does the job.

myElement.addEventListener("click", event => {});

Next thing i'm trying to figure out to disable all zooming is preventing pinch.

Unfortunately, touch events are not dispatched during iOs momentum scrolling. The following code works as long as the page is not scrolling (tested only on 12.2) :

document.addEventListener("touchstart", event => {
    if(event.touches.length > 1) {
        console.log("zoom plz stahp");
        event.preventDefault();
        event.stopPropagation(); // maybe useless
    }
}, {passive: false});

Solution 2:

Add CSS style touch-action: pan-y to <body> tag. That's all.

Solution 3:

To disable the double tap and pinch gestures I chose the following combination:

Disabling double tap:

document.addEventListener("click", event => {
  event.preventDefault()
  event.stopPropagation()
})

Disabling pinch gesture:

<head><metaname="viewport"content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /></head>

Post a Comment for "Disable Double Tap Zoom/resize On Safari Ios12***"