html - 如何在 Angular webapp 的移动浏览器中禁用 IOS 双击缩放?(我什么都试过了)
问题描述
我试过了 :
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
和
body {
touch-action: manipulation !important;
}
没有任何效果,我仍然可以在 iOS 上双击 safari 和 chrome。
有任何想法吗 ?谢谢你。
解决方案
全局禁用双击缩放的 CSS:
* {
touch-action: manipulation;
}
编辑:
我在带有 IOS v14.4.2 的 iPhone 7 Plus 上对此进行了测试,它对我有用。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>No double tap</title>
<style>
.no-double-tap {
touch-action: manipulation;
}
</style>
</head>
<body>
<h2>no double tap</h2>
<img class="no-double-tap" src="https://picsum.photos/id/1/200/300">
<h2>double tap</h2>
<img src="https://picsum.photos/id/2/200/300">
</body>
</html>
推荐阅读
- yii2-advanced-app - 如何访问两个项目(Yii1 和 Yii2)之间的文件?
- node.js - 安装 polka socket.io 之间的错误?
- javascript - 如何使网格的某些区域不可点击?
- google-apps-script - 使用谷歌脚本进行网络抓取(使用谷歌电子表格)
- python - 将美丽的汤嵌套循环垂直输出到数据框中
- linux - docker中的多个桥接网络?
- java - 在java中使用 compareTo() 方法比较大小写
- vba - 如何使用单元格值作为收件人发送带有模板的电子邮件?
- docker - MariaDB galera 集群 10.2 第二个节点“无法打开通道”
- node.js - 如何使用 Node JS / Webdriver.io / Chimp 打印到 PDF?