Firefox disable browser zoom but allow element zoom on pinch

人盡茶涼 提交于 2019-12-01 08:17:44

问题


I've got a site running aimed at touchscreens running Firefox (very specific I know, but it will hopefully help with a solution) On the page in question, I've got a d3 map that I'm trying to enable pinch zooming for, however any pinch gesture is causing Firefox to set the zoom for the whole page. Is there a way to prevent the page zooming and only allow the map to zoom?

It's not an issue if I have to modify Firefox config settings but I'd prefer to avoid it and rely entirely on javascript if possible.

Thank you in advance


回答1:


You might be able to do this using the viewport metatag and Hammer.js

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

This will disable the default browser zoom.


You can then use Hammer.js to capture gesture events which you will then pass to your D3.js code to zoom your map



来源:https://stackoverflow.com/questions/29850902/firefox-disable-browser-zoom-but-allow-element-zoom-on-pinch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!