我正在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
});
当我点击图片时,点击工作正常,但图片周围有蓝色叠加层。
我不明白如何删除它。我尝试了很多方法,但没有一个答案有效。请帮忙。谢谢
答案 0 :(得分:28)
您可以通过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;
}
答案 1 :(得分:3)
试试这个:
<强> CSS 强>
.press, img, .press:focus, img:focus{
outline: 0 !important;
border:0 none !important;
}
答案 2 :(得分: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;
}
从这里回答:How to remove the border highlight on an input text element
答案 3 :(得分:0)
可能是包含按钮的div上的背景颜色或边框颜色。其他 完全点击后使用如下代码删除css
$("#myButton").click(function(){
$("#displayPanel div").removeClass('someClass');
});