Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 detect function when(if user is double tapped?

I spend 2weeks for that i still not find the solution.. This is what i tried... CSS:

* {
  -webkit-text-size-adjust: none;
  zoom: 1;
  touch-action: manipulation;
}
* {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

and disable viewport zooming iOS 10+ safari?

I hate safari..

like image 586
ominsi kathsas Avatar asked Nov 28 '22 13:11

ominsi kathsas


2 Answers

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});
like image 147
nicopowa Avatar answered Dec 06 '22 04:12

nicopowa


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

like image 41
Marco Marsala Avatar answered Dec 06 '22 05:12

Marco Marsala