Windows Phone 7浏览器 - 单击链接时关闭灰色阴影

时间:2011-06-16 20:12:38

标签: internet-explorer windows-phone-7 browser

使用Windows Phone 7浏览器,当用户单击链接时,它将以灰色矩形着色约0.5秒。这通常很好,但是,如果您有动态页面行为,例如,单击链接更新DOM以使链接不再可见,则在链接本身消失后,不透明的灰色矩形在屏幕上徘徊。

这看起来非常糟糕!

有谁知道如何禁用此效果?

4 个答案:

答案 0 :(得分:19)

在你的html文件的head部分添加一个元标记。

<meta name="msapplication-tap-highlight" content="no" /> 

它应该有用。

答案 1 :(得分:2)

以下解决方案似乎有效(至少在模拟器上)。灰色阴影需要单击元素的尺寸。如果元素的宽度为零,则没有着色,而单击子元素仍然会触发元素的单击处理程序。

<div id="myLink" style="float:left">
   <img src="images/myLinkIcon.png" style="position:absolute" />
   <span style="position:absolute;left:50px">Click here</span>
</div>

<script>
    // jQuery
    $(function () {
        $("#myLink").click(function () {
            console.log("clicked on myLink");
        });
    });
</script>

div可以浮动或绝对定位。子元素必须绝对定位,否则div获得宽度。

答案 2 :(得分:1)

这可以尝试使用jquery

$(id|classname|document).live('click',function(){
   //write code that needs to executed in this area
});

我在我的项目中使用了这个。它可以隐藏灰色阴影,避免在html页面中使用内联函数...使用jquery这个函数只有在为内部内容分配时才有效...例如

<div id="d1"><div id="d2"></div></div>

你可以这样做内部div这样

$('#d2").live('click',function(){changecolor();changebackground();});

享受编码........ jquery

答案 3 :(得分:-1)

解决方案是制作2个DIV。主div没有宽度/高度,这个DIV是射击事件,DIV里面有大小。

我和朋友一起在phonegap项目中做了一些工作。检查链接:https://github.com/sellupp/cordova-for-windows-phone-7-antidepressant 您正在寻找:1。点击灰色区域

我们也在处理响应时间短的问题。看看吧;)