js 页面禁止滑动

页面禁止滑动 && 滑动

      /***滑动限制***/
      stop(){
        var mo=function(e){e.preventDefault();};
        document.body.style.overflow='hidden';
        document.addEventListener("touchmove",mo,false);//禁止页面滑动
      },
      /***取消滑动限制***/
      move(){
        var mo=function(e){e.preventDefault();};
        document.body.style.overflow='';//出现滚动条
        document.removeEventListener("touchmove",mo,false);
      }
      ```
发布了3 篇原创文章 · 获赞 2 · 访问量 177

猜你喜欢

转载自blog.csdn.net/qq_39143170/article/details/100774160
今日推荐