联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > 网页前端技术 > 正文

禁止选中文字兼容IE、Chrome、FF等 - Web前端

作者:98wpeu发布时间:2026-08-01分类:网页前端技术浏览:3


导读:复制代码代码如下:$(el).attr('unselectable','on').CSS({'-moz-user-select':'-moz-none','-moz-User...
复制代码 代码如下:
$(el).attr('unselectable','on')
.CSS({'-moz-user-select':'-moz-none',
'-moz-User-select':'none',
'-o-user-select':'none',
'-khtml-user-select':'none', /* you could also put this in a class */
'-WEBkit-user-select':'none',/* and add the css class here instead */
'-ms-user-select':'none',
'user-select':'none'
}).bind('selectstart', function(){ returnfalse; });

根据上面分析 可以设置 你需要禁止选中文字区域的 css。如:
复制代码 代码如下:
.table {
text-align: center;
vertical-align:middle;
height: 39px;
overflow: hidden;
moz-user-select: -moz-none;
-moz-user-select: none;
-o-user-select:none;
-kHTML-user-select:none; /* you could also put this in a class */
-webkit-user-select:none;/* and add the CSS class here instead */
-ms-user-select:none;
user-select:none;/**禁止选中文字*/
}

标签:文字WebFFChrome


网页前端技术排行
最近发表
网站分类
标签列表