因此,这似乎有些棘手。有一个包含某些区域的图像地图,其功能类似于:


单击一个区域,显示工具提示


这是一些代码(只是一个片段):

<img src="content/dummy/1_small.jpg" alt="" usemap="#img_1">
<map name="img_1">
    <area shape="rect" coords="150,50,250,150" href="" alt="" />
    <area shape="rect" coords="250,500,350,600" href="" alt="" />
</map>


以及相应的单击处理程序:

this.areas.click( function (event) {
    var position    = that.areas.index(event.target);
    that.toggleTooltipTouch(position);
    event.preventDefault();
});


哪个工作正常。但是:每当我单击某个区域时,Safari就会在触摸事件发生时显示一个稍微透明的小方框。如果击打得很短,它似乎在闪烁。

因此,问题是:如何防止这种行为并且不显示该框?

最佳答案

iOS dark gray box active style中所述,您必须隐藏点击突出显示框:

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

关于jquery - iOS Safari移动图像图-单击时区域显示框,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11156137/

10-12 12:45
查看更多