移动端页面滑动时候警告:Unable to preventDefault inside passive event listener due to target being treated as passive.
移动端项目中,在滚动的时候,会报出以下提示:
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
See https://www.chromestatus.com/features/5093566007214080
解决
- 在
touch的事件监听方法上绑定第三个参数{ passive: false },
通过传递 passive 为 false 来明确告诉浏览器:事件处理程序调用 preventDefault 来阻止默认滑动行为。
target.addEventListener('touch', function () {
}, { passive: false });
- 在 CSS 中全局使用:
* {
touch-action: pan-y;
}
touch-action 的使用方法见:https://developer.mozilla.org/zh-CN/docs/Web/CSS/touch-action
参考:
https://juejin.im/post/5ad804c1f265da504547fe68
https://www.jianshu.com/p/04bf173826aa
移动端页面滑动时候警告:Unable to preventDefault inside passive event listener due to target being treated as passive.的更多相关文章
- [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
1.滑动时候警告[Intervention] Unable to preventDefault inside passive event listener due to target being tr ...
- Unable to preventDefault inside passive event listener due to target being treated as passive
Unable to preventDefault inside passive event listener due to target being treated as passive 今天在做项目 ...
- IScroll Unable to preventDefault inside passive event listener due to target being treated as passive
最近两天企业微信下IScroll突然无法滚动了,特别慢,之前好好的,发现主要是有红色的Unable to preventDefault inside passive event listener du ...
- [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
相信如果用谷歌浏览器做移动端页面的时候 用touch事件的时候应该遇到过这个东东吧 documet.addEventListener("touchstart",function() ...
- 滑动报 Unable to preventDefault inside passive event listener due to target being treated as passive 的解决方法
google浏览器滑动出现以下问题: 解决办法如下:在html元素下添加样式 touch-action: none; html{ touch-action:none; }
- Vue移动端报错[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
解决方法如下 项目方案: 在最外侧添加样式操作 .
- Unable to preventDefault inside passive event listener due to target being treated as passive?
使用滚动时候,新版google浏览器,会弹出如下的警告. 解决方法,可以加上* { touch-action: none; } 这句样式去掉. 其原因:https://developers.googl ...
- 关于Google浏览器Unable to preventDefault inside passive event listener due to target being treated as passive.的解决方案
最近写react项目的时候,引用了antd-mobile,在使用滚动组件的时候,发现谷歌浏览器会报以下警告 最初我以为是antd-mobile的问题导致的,然后我就无查看了之前的vue的项目,发现了类 ...
- Unable to preventDefault inside passive event listener due to target being treated as passive 怎么办?
本篇为转载,原文链接:https://blog.csdn.net/lijingshan34/article/details/88350456 翻译一下:chrome 监听touch类事件报错:无法被动 ...
随机推荐
- Problem2-Project Euler
Even Fibonacci numbers Each new term in the Fibonacci sequence is generated by adding the previous ...
- python自学——函数-strftime
strftime()函数的用法 strftime()函数可以把YYYY-MM-DD HH:MM:SS格式的日期字符串转换成其它形式的字符串. strftime()的语法是strftime(格式, ...
- 解决iPhone滑动时滑到另一个层级导致卡顿问题
问题概览: 两个div都可以滑动时,会造成滑动顶层div时,底层div也会跟着滑动.如图示. 解决方法: 添加CSS即可. 代码如下 * { -webkit-overflow-scrolling: t ...
- Georgia Tech Online Master of Science in Computer Science 项目经验分享
Georgia Tech Online Master of Science in Computer Science 项目经验分享 Posted on 2014/04/22 项目关键词:工科名校,计算机 ...
- [IDEA_6] IDEA 集成 Python
0. 说明 在 IDEA 中集成 Python 1. IDEA 集成 Python 1.1 Ctrl + Alt + S 进入设置 依次选中 Settings --> Plugins -- ...
- [Spark Core] Spark 实现气温统计
0. 说明 聚合气温数据,聚合出 MAX . MIN . AVG 1. Spark Shell 实现 1.1 MAX 分步实现 # 加载文档 val rdd1 = sc.textFile(" ...
- 模拟的confirm
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title> ...
- SQL一字段内的字符串按照特定字符串转化为多行显示
有如下数据表 需求就是将Col1,Col2按照特定的字符串分割成多行 一.利用XML解析方式 先将该字段值统一替换为逗号分割,再将逗号分割替换转为XML数据类型,再利用xml转为多个行 declare ...
- SDN 第四次上机作业
1.建立以下拓扑,并连接上ODL控制器. 2.利用ODL下发流表,使得h3在10s内ping不通h1,10s后恢复. 3.借助Postman通过ODL的北向接口下发流表,再利用ODL北向接口查看已下发 ...
- Windows2008 Server r2 64位显示桌面图标的方法
点击桌面左下方的开始菜单,在搜索框中输入“icon”,如下图所示: 点击:显示或隐藏桌面上的通用图标,然后弹出如下图: 应用并确定即可!