function isScroll(){
event.stopPropagation();
event.preventDefault();
}
window.addEventListener("touchmove", isScroll, {passive:false});
当使用上面方法阻止touchmove后可以使用removeEventListener恢复touchmove
window.removeEventListener("touchmove", isScroll);
注意添加和移除监听时,第二个参数只能用函数名,不能直接写成function(){}形式,否则remove时认为不是同一个东西无法恢复,remove时可以不用第三个参数
804

被折叠的 条评论
为什么被折叠?



