移动Safari / Webview中的touchstart防止灰色覆盖

我正在webkit中构build一个iOS应用程序,所以我的整个UI都是一个webview。 在webview的外边界附近的任何元素的touchStart(没有绑定touchStart事件),我得到一个半透明的灰色框覆盖webview的整个区域。 我已经取消了-webkit-tap-highlight-color-webkit-touch-callout作为原因。 我该如何消除这种行为?

只是把这种风格,你仍然有默认的行动,但没有灰色覆盖

 a { -webkit-tap-highlight-color: rgba(0,0,0,0); } 

如果你想删除操作面板,就把这个

 a { -webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-touch-callout: none; } 

你去了! 清洁链接!

我的工作解决scheme是捕获和防止HTML文档正文的touchstart事件的touchstart 。 所有其他更明确的事件处理程序不受影响。 我遇到了一个select元素的问题,我在主体事件处理程序(我正在使用jQuery)中解决了这个问题:

 $('body').live( 'touchstart', function(e){ if(e.target.localName != 'select'){ e.preventDefault(); } }