Chrome和Safari浏览器preventDefault报treated as passive错误

Chrome和Safari浏览器preventDefault报treated as passive错误

问题代码是:

document.addEventListener('touchmove', function (event) {
    event.preventDefault();
});

修复后的JavaScript代码是:

document.addEventListener('touchmove', function (event) {
    event.preventDefault();
}, {
    passive: false
});

检索代码中
addEventListener 
关键字,false改为{passive: false}

posted on 2019-06-19 10:11  studyphp  阅读(241)  评论(0编辑  收藏  举报

导航