const moveStop = function(e){e.preventDefault()};
添加阻止事件:
function noScroll(){
document.body.style.overflow='hidden';//关闭滚动条
document.addEventListener("touchmove",moveStop,false);
}
移除阻止事件:
function isScroll(){
document.body.style.overflow='';//出现滚动条
document.removeEventListener("touchmove",moveStop,false)
}
弹出层弹出时禁止滑动
最新推荐文章于 2024-05-06 15:59:29 发布