单击时删除html图像上的蓝色突出显示

Vin*_*raj 11 html jquery

我正在Android中制作自定义应用程序.我在div中显示一个带有img标签的html页面.

<div class="press">
    <img src="but.png" width="150" height="62" border="0"/>
</div>
Run Code Online (Sandbox Code Playgroud)

在我写的javascript中:

$(".press").bind("click",function()    
{
//display something
});
Run Code Online (Sandbox Code Playgroud)

当我点击图像时,点击工作正常,但图像被蓝色覆盖图包围.

图片1

单击图像时的图像2

我不明白如何删除它.我尝试了很多方法,但没有一个答案有效.请帮忙.谢谢

Par*_*sar 29

您可以通过css阻止在您的页面上进行选择.您可以将*选择器更改为要阻止选择的元素选择器.

/*IE9*/
*::selection 
{
    background-color:transparent;
} 
*::-moz-selection
{
    background-color:transparent;
}
*
{        
    -webkit-user-select: none;
    -moz-user-select: -moz-none;
    /*IE10*/
    -ms-user-select: none;
    user-select: none;

    /*You just need this if you are only concerned with android and not desktop browsers.*/
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}    
input[type="text"], textarea, [contenteditable]
{

    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}
Run Code Online (Sandbox Code Playgroud)

  • `-webkit-tap-highlight-color`正是我想要的!非常感谢 !! (6认同)