当前位置:网站首页>H5在移动端上禁止缩放
H5在移动端上禁止缩放
2022-07-22 09:02:00 【Agwenbi】
const disableZoom = () => {//禁止缩放
let lastTouchEnd = 0;
document.documentElement.addEventListener('touchend', (event) => {//禁止双击放大
var now = Date.now();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
}, false);
document.documentElement.addEventListener('touchstart', (event) => {//禁止双指缩放
if (event.touches.length > 1) {
event.preventDefault();
}
}, false);
}
边栏推荐
猜你喜欢
QT笔记——QTableWidget 之 指定某列排序
女嘉宾报名
主动降噪耳机排行榜10强,主动降噪耳机十大品牌
QT notes - vs generating multiple exe files for a project
Simplify the complexity and talk about the abstraction of replication state machine system architecture
"Review of software engineering in Wuhan University of technology" Chapter III software requirements
Thread learning notes
化繁为简,聊一聊复制状态机系统架构抽象
It took two hours to find the bug about scrollto scrolling the distance from offsettop to the top
DistSQL 深度解析:打造动态化的分布式数据库
随机推荐
QT notes - qjason
DistSQL 深度解析:打造动态化的分布式数据库
Android互联网大厂面试经验
Fabric.js 居中元素
double类型不能进行精确计算的问题
力扣解法汇总1175-质数排列
Research on vulnerability identification technology for project version differences
女嘉宾报名
关于scrollTo滚动offsetTop到顶部的距离的bug找了两个小时
visual studio 调试快捷键
Visual studio debugging shortcut key
力扣解法汇总1051-高度检查器
力扣解法汇总814-二叉树剪枝
请教下,oracle-cdc是不是不支持检查点,当实时采集过程中任务挂了到重启这段时间的数据变化是不
flutter 线性布局让两个控件充满一行
力扣解法汇总731-我的日程安排表 II
Fabric.js 居中元素
文件描述符的复制
QT notes - qudpsocket of network communication
Verilog for loop (1)