stop () {
var mo = function (e) {
e.preventDefault()
}
let cssStr = 'overflow-y: hidden; height: 100%;'
document.getElementsByTagName('body')[0].style.cssText = cssStr
document.documentElement.style.height = '100%'
document.documentElement.style.overflow = 'hidden'
document.body.style.cssText = cssStr
document.addEventListener('touchmove', mo, false) // 禁止页面滑动
},
// 取消滑动限制
move () {
var mo = function (e) {
e.preventDefault()
}
let cssStr = 'overflow-y: auto; height: auto;'
document.getElementsByTagName('body')[0].style.cssText = cssStr
document.documentElement.style.overflow = 'scroll'
document.body.style.cssText = cssStr
document.removeEventListener('touchmove', mo, false)
},
禁止页面滚动移动端
最新推荐文章于 2023-03-09 14:28:48 发布