移動端阻止長按文字出現選中效果

移動端有時候會需要長按保存圖片,但當頁面中有文字時,長按會出現選中文字時的框,用戶會感覺很奇怪。

禁止目標文字被選中

//在需要禁止選中的文字所在位置加上以下css樣式
.txt {
    -webkit-touch-callout:none;
    -webkit-user-select:none;
    -khtml-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章