文本选择问题: css & js

CSS:

 1 /*Disable browser selection*/
 2 .disableselect
 3 {
 4     -webkit-user-select: none;
 5     -moz-user-select: none;
 6     user-select: none;
 7     -ms-user-select:none;
 8     -webkit-touch-callout:none;
 9     -webkit-tap-highlight-color: rgba(0,0,0,0);
10 }
11 .enableselect {
12     -webkit-user-select: text;
13     -moz-user-select: text;
14     -ms-user-select:text;
15     user-select:all;
16 }

 

JS:

1 var clearSlct= "getSelection" in window ? function(){
2  window.getSelection().removeAllRanges();
3 } : function(){
4  document.selection.empty();
5 };

 

posted @ 2016-05-08 08:51  z s k  阅读(181)  评论(0编辑  收藏  举报