javascript - 如何在 Opera 移动浏览器中禁用高亮选择

标签 javascript html css

当我通过 Opera 移动浏览器 (12.10.ADR-1309251116) 按下页面的按钮时,会出现突出显示的选择。因为高亮选择在我的人物离开屏幕后延迟了大约 0.5 秒,所以我想禁用它,但失败了。这是我的代码片段:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    
    <meta name="viewport"
      content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"/>
</head>

<body>

<style type="text/css">
   * {
      margin: 0;
      padding: 0;
       list-style-type: none;
   }

.btn{
    width: 100px;
    height:  50px;
    margin: 20 auto;
    -webkit-tap-highlight-color: rgba(0,0,0,0);    
    -moz-user-select: none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drga: none;
    -webkit-touch-callout: none;
}
</style>
<body>  
    <button class="btn unselectable" unselectable="on"  >click me</button>
</body>
</html>

enter image description here

有什么建议吗?

最佳答案

Opera Classic 上使用 user-select: none 阻止文本/元素选择是不可能的,参见 Here .

关于javascript - 如何在 Opera 移动浏览器中禁用高亮选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24263723/

相关文章:

jquery - 如何只滚动到一个div,而不是整个页面?

javascript - 有没有办法取回在 Prototype 中使用 Event.observe 注册的匿名事件处理程序?

javascript - 视频未填满页面宽度

HTML5 本地存储和变量类型

javascript - 当用户滚动到页面底部时显示页脚

html - 选择框对齐

javascript - 在 Javascript 或 jQuery 中查找两个字符串之间的字符串

Javascript:从字符串附加事件,在闭包中评估变量

javascript - 如何让我的 javascript 图像 onMouseOver 代码在 html 图像映射中工作?

jquery - 有没有办法通过 jQuery 更改样式