disable Double tap zoom/resize on safari IOS12***

2019-08-17 18:27发布

问题:

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..

回答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});