Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
595 views
in Technique[技术] by (71.8m points)

页面阻止了点击事件,怎么恢复?

document.body.addEventListener('click',(e) => {
    e.preventDefault()
})

这样阻止了页面的点击事件,想恢复,不能用removeEventListener,还有什么办法?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

没看懂什么问题,可以写个小demo出来看下,是什么被阻止了。以前搞百度文库复制的时候,可以写类似下面的代码阻止:

document.body.addEventListener('click', e => {
      e.stopImmediatePropagation();
    }, true);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...