移动端手机页面 禁用/阻止长按进行复制粘贴选择的操作

在页面样式内加入
*{
-webkit-touch-callout:none; /系统默认菜单被禁用/
-webkit-user-select:none; /webkit浏览器/
-khtml-user-select:none; /早期浏览器/
-moz-user-select:none;/火狐/
-ms-user-select:none; /IE10/
user-select:none;
}

在添加完这段代码后,在IOS 上会有问题的,这个时候你会发现input 框无法正在输入了内容了;
造成这个原因就是 -webkit-user-select:none; 这个属性造成的。

解决这个方法 就是 在css 文件中同时设置一下input/texteare 的属性,如下所示:

input , texteare{
-webkit-user-select:auto;
}

猜你喜欢

转载自blog.csdn.net/MtangEr/article/details/88977384