滑动时报错[Intervention] Unable to preventDefault inside passive event listener due to target being treat

Posted emma-zhao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了滑动时报错[Intervention] Unable to preventDefault inside passive event listener due to target being treat相关的知识,希望对你有一定的参考价值。

移动端Web界面滚动性能优化 Passive event listeners

 

解决办法1:

在touch的事件监听方法上绑定第三个参数{ passive: false },
通过传递 passive 为 false 来明确告诉浏览器:事件处理程序调用 preventDefault 来阻止默认滑动行为。

elem.addEventListener(
  ‘touchstart‘,
  fn,
  { passive: false }
);

解决办法2:

 * { touch-action: pan-y; } 
 使用全局样式样式去掉

 

以上是关于滑动时报错[Intervention] Unable to preventDefault inside passive event listener due to target being treat的主要内容,如果未能解决你的问题,请参考以下文章

laravel安装intervention/image图像处理扩展 报错fileinfo is missing

滑动验证码验证

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as

出现弹窗后,父级页面还能进行滑动或滚动的问题

Web前端笔记-解决[Intervention] Unable to preventDefault inside passive event listener due to target being

stanfordcorenlp处理中文含有 % 时报错解决