美文网首页
JS关于阻止浏览器默认行为(手机浏览器上禁止滑动)

JS关于阻止浏览器默认行为(手机浏览器上禁止滑动)

作者: 红烧牛腩 | 来源:发表于2017-06-20 10:57 被阅读0次

Step1—添加事件

//定义窗口默认事件

window.eventDefault= function(e) {

e.preventDefault();

};

//绑定浏览器禁止滑动事件

document.addEventListener('touchmove',eventDefault,false);

Step2—解除事件绑定

document.removeEventListener('touchmove',eventDefault,false);

相关文章

网友评论

      本文标题:JS关于阻止浏览器默认行为(手机浏览器上禁止滑动)

      本文链接:https://www.haomeiwen.com/subject/edeoqxtx.html