移動端手機頁面 禁用/阻止長按進行復制粘貼選擇的操作


在頁面樣式內加入
*{
-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;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM