javascript
SunSeekerX ... 2020年4月15日 06:46 小于 1 分钟
# javascript
# 01. 完美解决 ios10 及以上 Safari 无法禁止缩放的问题
window.onload = function () {
document.addEventListener('touchstart', function (event) {
if (event.touches.length > 1) {
event.preventDefault()
}
})
var lastTouchEnd = 0
document.addEventListener(
'touchend',
function (event) {
var now = new Date().getTime()
if (now - lastTouchEnd <= 300) {
event.preventDefault()
}
lastTouchEnd = now
},
false
)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19