Disable pinch zoom in webkit (or electron)

后端 未结 9 2315
北荒
北荒 2020-12-29 02:23

Is there any way to disable pinch zoom in an electron app?

I can\'t get it to work from inside the web-view with normal javascript methods as described here: https:/

9条回答
  •  旧时难觅i
    2020-12-29 02:36

    It seems very difficult for desktop browser to prevent pinch zoom.

    Here are some ideas though!

    1) By using some gestures javascript like hammer.js, detect Pinch event and try to prevent it using e.preventDefault

    OR

    2) Design everything using "%" in css, or use newer units like "vm" etc, (if possible). This way, even page will be zoomed, but content will stay the same for any zoom level.

    All the best!

提交回复
热议问题