【发布时间】:2011-10-06 15:05:56
【问题描述】:
在以下代码中,onclick 事件在使用 android 浏览器时永远不会触发:
<div id="__log"></div>
<div id="hud">
<div>Hello</div>
<div>
<a style="border:1px solid #fff;" href="#" onclick="document.getElementById('__log').innerHTML = document.getElementById('__log').innerHTML + '<br />clicked'; return false;">Click Me</a
</div>
</div>
风格:
#hud {
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
padding: 10px;
background:transparent url('gray95op.png') repeat;
-webkit-transform: scale(1);
-webkit-transition: all 0.25s ease-in-out;
position: fixed;
top:10px;
left:0;
right:0;
margin:0 auto;
width: 75%;
z-index: 1001;
color: #fff;
text-align:center;
}
#hud a { color: #ccc; z-index:1002; }
这在 iPhone 上的 Safari 和桌面上的 Chrome 中运行良好。
以下是您可以在 Android 设备上亲自尝试的示例:http://kortina.net/android.html
【问题讨论】:
-
你试过
position: absolute吗? Android 浏览器可能对position: fixed的支持较差。
标签: javascript android css