ZhaoWeiNotes

如果想要禁止整个页面滚动:

document.body.addEventListener(\'touchmove\', function(e){
     e.preventDefault();
 }, { passive: false });  //passive 参数不能省略,用来兼容ios和android

如果想要禁止弹框滚动:

var modal=document.getElementById("modal");
modal.addEventListener(\'touchmove\', function(e){
    e.preventDefault();
}, { passive: false });  //passive 参数不能省略,用来兼容ios和android

 

分类:

技术点:

相关文章: