我的移动端网页有个菜单,现在需要菜单出现禁止用户滚动页面,菜单隐藏恢复正常,下面是我的想法,但是没有效果,请问是什么问题,谢谢!
var a=document.addEventListener('touchmove',function(event){
event.preventDefault();
})
if(omenu.show()){
document.addEventListener(a);
}else{
removeEventListener(a);
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
event事件是必须的!不能省略所以就如 guangpunba写的一样 把touchmove拿出来