2011-12-26 13 views
5

Czy istnieje sposób na umieszczenie granicy wokół numeru <area>?Jak umieścić granicę na obszarze?

muszę to zrobić dla testowania Imagemap, ale to nie działa:

area { 
    outline: 1px solid red; 
    border: 1px solid red; 
} 
+0

Może ten plugin pozwala http: //plugins.jquery. com/project/maphilight –

+0

Ten link nie żyje. Oto kolejna: http://davidlynch.org/projects/maphilight/docs/ – Urbycoz

Odpowiedz

4

Jeśli jesteś gotów użyć JavaScript, dodać mouseover/mouseout detektory zdarzeń do <area> elementów i .focus()/.blur().

Demo: http://jsfiddle.net/ThinkingStiff/Lwnf3/

Scenariusz:

var areas = document.getElementsByTagName('area'); 
for(var index = 0; index < areas.length; index++) {  
    areas[index].addEventListener('mouseover', function() {this.focus();}, false); 
    areas[index].addEventListener('mouseout', function() {this.blur();}, false); 
}; 

HTML:

<img id="map" src="http://thinkingstiff.com/images/matt.jpg" usemap="#map"/> 
<map name="map"> 
    <area shape="circle" coords="50,50,50" href="#" /> 
    <area shape="circle" coords="100,100,50" href="#" /> 
</map> 

CSS:

#map { 
    height: 245px; 
    width: 180px; 
} 
+1

+1 To bardzo schludna odpowiedź! Tks. Nauczyłem się dzisiaj nowej techniki. – techfoobar

+0

Ja też! Thx za pomoc! :RE – timkl

Powiązane problemy