Javascript 如何在iOS 10 Safari上禁用网页缩放?
似乎:Javascript 如何在iOS 10 Safari上禁用网页缩放?,javascript,html,ios,safari,Javascript,Html,Ios,Safari,似乎: …在iOS 10更新后已停止使用mobile Safari 有没有办法再次禁用pinch2zoom 请不要回答“不要这样做,过时的易访问性gyan和卷轴是如何为web工作的”,因为你不了解我的用户或我的需求,我不希望这条线索成为老派web开发人员和新一代之间的又一场火焰战 我很高兴使用JavaScript在站点范围内禁用pinch2zoom 对于点击事件: document.addEventListener('touchmove', event => { if (event.
…在iOS 10更新后已停止使用mobile Safari
有没有办法再次禁用pinch2zoom
请不要回答“不要这样做,过时的易访问性gyan和卷轴是如何为web工作的”,因为你不了解我的用户或我的需求,我不希望这条线索成为老派web开发人员和新一代之间的又一场火焰战
我很高兴使用JavaScript在站点范围内禁用pinch2zoom 对于
点击事件:
document.addEventListener('touchmove', event => {
if (event.scale !== 1) { event.preventDefault() }
}, false)
let lastTouchEnd = 0;
document.addEventListener('touchend', event => {
const now = (new Date()).getTime()
if (now - lastTouchEnd <= 300) event.preventDefault()
lastTouchEnd = now
}, false)
对于双击事件:
document.addEventListener('touchmove', event => {
if (event.scale !== 1) { event.preventDefault() }
}, false)
let lastTouchEnd = 0;
document.addEventListener('touchend', event => {
const now = (new Date()).getTime()
if (now - lastTouchEnd <= 300) event.preventDefault()
lastTouchEnd = now
}, false)
让lastTouchEnd=0;
document.addEventListener('touchend',事件=>{
const now=(新日期()).getTime()
如果(现在-最后一次触摸结束)