CSS-禁止文本被选中
2024-09-04 01:25:37
pc端:
.not-select{
-moz-user-select:none; /*火狐*/
-webkit-user-select:none; /*webkit浏览器*/
-ms-user-select:none; /*IE10*/
-khtml-user-select:none; /*早期浏览器*/
user-select:none;
}
移动:
.no-touch {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
js方法:
ontouchstart="return false;"
在需要禁止的dom上添加这段代码,两种方法对于安卓和IOS的支持没有单独测试过。两个同时使用,对于安卓和IOS可以起到禁止作用。
最新文章
- 编译安装nginx
- 2003服务器搭建vpn
- DecoratorPattern(装饰器模式)
- thrift 学习
- Nginx 启动脚本/重启脚本
- Jquery获取selelct选中值
- Spring Batch学习
- HDU 5754 Life Winner Bo (找规律and博弈)
- Git 笔记二-Git安装与初始配置
- hdu2399GPA
- MFC_Office
- Android viewpager 嵌套 viewpager滑动 点击事件冲突解决方案
- 基于visual Studio2013解决面试题之0804复杂链表
- [Swift]LeetCode646. 最长数对链 | Maximum Length of Pair Chain
- MySQL学习笔记(一)Ubuntu16.04中MySQL安装配置(5.6优化、错误日志、DNS解决)
- 利用h5 meta 头标签设置og属性进行帖子分享图片时而有时而无
- VB VB 定义及区别
- I/O系统(二)
- 谈谈我们对userAgent的看法,为什么爬虫中需要userAgent?
- Linux下安装SQL Server 2016(准备篇SQL Server on linux)