【JS】禁止页面滑动滚动,兼容ios
作者:互联网
const PASSIVE = function (e) {
e.preventDefault();
}
// 禁止
document.body.style.overflow = 'hidden';
document.addEventListener('touchmove', PASSIVE, {
passive: false,
});
// 恢复
document.body.style.overflow = 'auto';
document.removeEventListener('touchmove', PASSIVE, {
passive: false,
});
标签:body,passive,style,false,JS,ios,兼容,PASSIVE,document 来源: https://www.cnblogs.com/mcky-love/p/14230318.html