Search code examples
javascriptjqueryzoomingjquery-eventsviewport

Unable to prevent Zoom


I'm trying to prevent zoom with the meta viewport and also event.prevent default() for the pinch event.

My ultimate goal is to run a function on pinch in and another function on pinch out, but that won't happen if pinch in / out zooms in / out.

So, I can still zoom in and out using pinch zoom in these pages:

http://the-irf.com/hammer/index1.html

http://the-irf.com/hammer/index2.html

If you can help me prevent zoom or even get the alerts to fire on pinch in and pinch out— I'd greatly appreciate it!


Solution

  • You don't have set the meta viewport tag correctly, It should be like below:

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    

    I see initial-scale, maximum-scale and user-scalable not present in your meta viewport tag