Mobile browser zoom detection

I want to know if there is a way to detect that the user is doing scaling.

I want to do two things when the user approaches:

  • let the div align the left side of the screen
  • set the width of the div equal to the width of the viewport

I found that Android has touchstart, touchendand touchmove, but they will not start during multitouch. I want to execute the above function immediately after scaling is complete.

Are there any other approaches?


I am not doing a web application. I just add some features to the mobile version.

+3
source share
2 answers

Android ScaleGestureDetector. . , , , , . ( ) .

0

Android- touchstart, touchend touchmove JavaScript, - , .

, IOS Android:

var obj = document.getElementById('elmId');
obj.addEventListener('touchmove', function(event) {
  if (event.targetTouches.length == 2) {
    console.log("exactly 2 fingers gesture inside elmId ");
  }
}, false);

, event.targetTouches.length 2.

IMHO, , ( , , ).

0

All Articles