移动端页面滑动时候警告: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类事件报错:无法被动 ...
随机推荐
- LeetCode题解之Reorder List
1.题目描述 2.题目分析 首先将链表分为两段,然后将后面的一段反转,再合并两个链表. 3.代码 void reorderList(ListNode* head) { if (head == null ...
- quarz时间配置
Cron表达式的格式:秒 分 时 日 月 周 年(可选). 字段名 允许的值 允许的特殊字符 秒 ...
- MVC 上传下载
在Asp.net的WEBform中,上传文件与下载文件处理是很简单的事情,如果转为ASP.NET MVC呢?那就没有那么容易了,难少少,也不是很难,一起来看下本文吧.本文主要讲如何在Asp.net M ...
- linux常见问题解决
1.登录环境故障的原理及解决办法? -bash-4.1$ -bash-4.1$ cp /etc/skel/.bash* .
- 【转】MaBatis学习---源码分析MyBatis缓存原理
[原文]https://www.toutiao.com/i6594029178964673027/ 源码分析MyBatis缓存原理 1.简介 在 Web 应用中,缓存是必不可少的组件.通常我们都会用 ...
- 关于在Win10的Windows功能中没有IE11的问题
大概是用Win7的时候把IE关掉了,升级Win10之后就发现IE不见了,在Windows功能里面也没有:最近因为某些原因需要用到IE,还是用的虚拟机. 网上找到的方法普遍是执行命令:FORFILES ...
- kafka服务无法启动的原因
kafka集群中一台服务器kill掉后再启动时报错. java.io.IOException: Map failed Caused by: java.lang.OutOfMemoryError: Ma ...
- sublime设置node.js编译
1. 首先需安装node环境并配置好环境变量,安装教程. 2. 然后在sublime中打开工具(Tools)→编译系统(Build System)→新编译系统(New Build System) 3. ...
- 谁对EXTJS熟悉,有关关闭panel的问题?
谁对EXTJS熟悉,有关关闭panel的问题?比如:我在A.js 中写了一个 var win = new Ext.Window( { b.js }); win.show(); 打开了一 ...
- laravel记录笔记Laravel 连接数据库、操作数据库的三种方式
laravel中提供DB facade(原始查找).查询构造器.Eloquent ORM三种操作数据库方式 1.连接数据库 .env 数据库配置 DB_HOST=localhost dbhost DB ...