2012-10-12 33 views
6

在Firefox(当前的版本14.0.1)中,我创建了here (http://mediabrands.com.au/)的一些<area>标签的虚线轮廓。我不仅看到虚线,而且一旦出现,我无法摆脱它(例如通过点击另一个区域)。如何从Firefox的<area>元素中删除虚线边框?

enter image description here

我搜索在这里和谷歌在相当长的时间,仍然没有设法摆脱他们。它们不会出现在任何其他浏览器中。

事情我已经试过(和下面的所有组合),但没有成功:

  • 添加outline: none到IMG,地图和区域标签(和他们的:focus:active)同行。
  • 向其中的每一个添加了border: none
  • hidefocus="hidefocus"添加到这些中的每一个。
  • 使用::-moz-focus-inner{ border: none; outline: none; }添加到各个元素的各种组合。
  • 为每个添加了.focus(function(){ $(this).blur(); })(jQuery)。

我相信我已经用尽了所有我能遇到的信息 - 有没有其他办法可以摆脱这些线?

这是为快速参考的HTML,并为东西在里面是我无法摆脱它的原因的可能性:

<img src="anatomy/dial/components/foundation.png" id="dial-map" usemap="#dial" /> 
<map name="dial"> 
    <area title="Ansible" class="tab" id="click-ansible" shape="poly" coords="412,419,376,447,313,474,248,487,247,434,327,415,374,377" href="#"> 
    <area title="Cadreon" class="tab" id="click-cadreon" shape="poly" coords="487,245,478,313,455,366,416,417,378,380,429,299,434,246" href="#"> 
    <area title="Orion" class="tab" id="click-orion" shape="poly" coords="418,73,453,117,482,191,484,242,431,244,422,180,378,111" href="#"> 
    <area title="Ensemble" class="tab" id="click-ensemble" shape="poly" coords="247,1,311,10,368,35,415,70,378,108,312,66,244,53" href="#"> 
    <area title="Reprise" class="tab" id="click-reprise" shape="poly" coords="73,69,111,39,176,8,242,2,243,53,172,66,112,108" href="#"> 
    <area title="Magna Global" class="tab" id="click-magnaglobal" shape="poly" coords="245,487,186,481,114,450,71,417,110,377,175,423,246,432" href="#"> 
    <area title="Airborne" class="tab" id="click-airborne" shape="poly" coords="69,414,37,373,12,316,2,244,55,244,68,322,106,375" href="#"> 
    <area title="Marketing Sciences" class="tab" id="click-analytics" shape="poly" coords="2,242,11,171,33,120,71,74,109,109,70,168,54,241" href="#"> 
    <area title="MB3" class="tab" id="click-mb3" shape="poly" coords="257,430,178,422,120,384,82,340,140,305,163,337,206,360,262,364,317,342,348,305,404,340,384,367,324,413" href="#"> 
    <area title="UM" class="tab" id="click-um" shape="poly" coords="307,134,245,116,246,56,309,68,375,109,418,178,430,237,429,288,404,339,350,303,368,246,358,198,344,169" href="#"> 
    <area title="Initiative" class="tab" id="click-initiative" shape="poly" coords="80,339,63,289,58,235,72,171,109,112,176,67,243,56,242,119,192,128,152,159,126,206,122,261,137,306" href="#"> 
    <area title="View Website" id="website" shape="poly" coords="173,330,139,292,133,213,161,167,196,143,245,129,305,146,336,176,359,246,339,300,309,335,260,352,209,351" href="#"> 
</map> 
+0

没有尝试大纲:0? –

+0

@Asad Yep,也试过'没有'。 – Marty

+0

我说这个真的很糟糕,但是再次尝试一下!重要的是什么?或者在某种孤立的环境中,没有所有额外的css和js。 –

回答

7

问题是dial.js行151上的模糊焦点功能。删除它可以解决问题。

$("img, area, map").focus(function(event) { 
    $(this).blur(); 
}); 

为了防止重点区域元素,设置一个tabindex-1,即

<area tabindex="-1" title="Ansible" class="tab" id="click-ansible" shape="poly" coords="... 

演示:http://jsfiddle.net/SO_AMK/K8Adx/

+0

我有'

-2

尝试使用CSS:text-decoration:none;

+0

没有区别:( – Marty

0

尝试设置区域聚焦和活动状态边境0,如下所示:

按照以下问题:Blue border around image maps in Internet Explorer 9

a, 
img { 
    outline: none; 
} 
map > area, 
map > area:active, 
map > area:focus { 
    outline: none; 
    border: 0; 
} 
+1

这是一个针对Internet Explorer的解决方案,问题是关于Firefox的问题 – Jocelyn

+0

这是正确的,但是css仍然可以解决FF中的问题,根据他没有试过的问题:focus and:active。 d点击链接后,似乎只会出现点线, – Aaron

+3

@Aaron在我的问题“我尝试过的东西”下面的问题中查看*点1 *。 – Marty

3

看来,模糊焦点是造成问题:

从dial.js删除:

// Prevent focus of areas. 
$("img, area, map").focus(function() { 
    $(this).blur(); 
}); 

这里是一个小提琴我做了简化一切:http://jsfiddle.net/MadLittleMods/gDrAS/ 评论,并取消对JavaScript查看不同的结果。


一种用于模糊和焦点解决方案是使用event.preventDefault()。所以,你可以更换什么是去除上面:

// Prevent focus of areas. 
$("img, area, map").focus(function(e) { 
    e.preventDefault(); 
}); 

也有使用tabindex="-1"属性tabindex修复。

+1

我相信关于'stopPropagation'的信息是错误的。从文档_注意,这不会阻止其他处理程序在同一个元素上运行。它似乎可以工作,因为它在代码示例中拼写错误并可能导致中断。 'event.preventDefault'将会更合适(或组合),但在快速测试中只会返回false;似乎一致地工作。 –

+0

@M attWhipple感谢拼写检查。修复。我相信有更多的功能可以产生相同的效果。 – MLM

相关问题