admin管理员组文章数量:1279247
I am using a library to highlight an image, and this image has the property touch-action: auto;. However, when clicking the close button to close the highlighted image, the zoom applied by the "pinch to zoom" gesture remains. I would like to reset this zoom on mobile.
I tried something like this, but it didn't work on iOS devices (Safari), and it also ends up limiting the zoom after the afterZoomOut function is called:
const viewportMetaTag = document.querySelector("meta[name=viewport]");
afterZoomIn={()=>viewportMetaTag?.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=10.0")}
afterZoomOut={()=>viewportMetaTag?.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0")}
I also tried, but it didn't have any effect on mobile:
document.body.style.scale = "1"
I am using a library to highlight an image, and this image has the property touch-action: auto;. However, when clicking the close button to close the highlighted image, the zoom applied by the "pinch to zoom" gesture remains. I would like to reset this zoom on mobile.
I tried something like this, but it didn't work on iOS devices (Safari), and it also ends up limiting the zoom after the afterZoomOut function is called:
const viewportMetaTag = document.querySelector("meta[name=viewport]");
afterZoomIn={()=>viewportMetaTag?.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=10.0")}
afterZoomOut={()=>viewportMetaTag?.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0")}
I also tried, but it didn't have any effect on mobile:
document.body.style.scale = "1"
Share
Improve this question
edited Feb 24 at 17:09
Guilherme Andeglieri
asked Feb 24 at 17:04
Guilherme AndeglieriGuilherme Andeglieri
32 bronze badges
1 Answer
Reset to default 0Currently, Safari does not support editing metatags once they have been created. Nothing worked for me, so I will have to create a component with a custom pinch or use a library that can help me.
本文标签: javascriptHow to reset the zoom given by the pinch to zoom gestureStack Overflow
版权声明:本文标题:javascript - How to reset the zoom given by the pinch to zoom gesture? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741251990a2365965.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论