11

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

<div class="press">
    <img src="but.png" width="150" height="62" border="0"/>
</div>

在我写的javascript中:

$(".press").bind("click",function()    
{
//display something
});

当我单击图像时,单击正在工作,但图像被蓝色覆盖层包围。

图 1

点击图片时的图片 2

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

4

4 回答 4

33

您可以通过 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;
}
于 2013-05-08T04:59:24.057 回答
3

尝试这个:

CSS

.press, img, .press:focus, img:focus{
    outline: 0 !important;
    border:0 none !important;
}
于 2013-05-08T05:00:20.773 回答
2

你可以使用 CSS:

** HTML **

<button class="press">
    <img src="but.png" width="150" height="62" border="0"/>
</button>

** CSS **

.press{
    outline-width: 0;
}

.press:focus{
    outline: none;
}

从这里获取答案:如何删除输入文本元素上的边框突出显示

于 2014-05-07T18:45:08.067 回答
0

它可能是包含按钮的 div 上的背景颜色或边框颜色。否则使用如下代码在完全点击后删除css

$("#myButton").click(function(){
   $("#displayPanel div").removeClass('someClass');
});
于 2013-05-08T04:59:58.787 回答