最近做移动端,弹出框加遮罩层后禁止滑动

//实现滚动条无法滚动
var mo=function(e){e.preventDefault();};

/***禁止滑动***/
function stop(){
        document.body.style.overflow='hidden';        
        document.addEventListener("touchmove",mo,false);//禁止页面滑动
}

/***取消滑动限制***/
function move(){
        document.body.style.overflow='';//出现滚动条
        document.removeEventListener("touchmove",mo,false);        
}

相关文章:

  • 2022-01-21
  • 2021-06-16
  • 2022-01-27
  • 2021-11-21
  • 2022-12-23
  • 2021-07-09
  • 2022-01-30
猜你喜欢
  • 2021-12-19
  • 2022-01-15
  • 2021-12-04
  • 2021-06-17
  • 2022-12-23
  • 2021-12-19
  • 2021-05-25
相关资源
相似解决方案