I am making a image map for our site navigation manual, I have generated a set of code which a div show on mouse hover...
EDIT
The code is all working however I need to highlight the area when mouse hover, is there an easy way to do this, I have tried to use other code however it will interrupt the original java script so the div no longer showing, any help is greatly appreciated!
function showHideDivs(indx) {
hideDivs();
oShowHideDivs[indx].style.display = 'block';
}
function hideDivs() {
for (i = 0; i < oShowHideDivs.length; i++) {
oShowHideDivs[i].style.display = 'none';
}
}
window.onload = function() {
oShowHideDivs = document.getElementById('container').getElementsByTagName('div');
var oMap = document.getElementById('myMap');
for (i = 0; i < oMap.areas.length; i++) {
oMap.areas[i].indx = i;
oMap.areas[i].onmouseover = function() {
showHideDivs(this.indx);
}
oMap.areas[i].onmouseout = hideDivs;
}
}
#container div {
display: none;
}
<div>
<img src="website.jpg" alt="" usemap="#myMap" />
</div>
<div id="container">
<div id="home">This is home</div>
<div id="about">This is about</div>
<div id="contact">This is contact</div>
</div>
<map name="myMap" id="myMap">
<area shape="rect" coords="0,0,100,100" href="" alt="home" />
<area shape="rect" coords="100,0,200,100" href="" alt="about" />
<area shape="rect" coords="0,100,100,200" href="" alt="contact" />
</map>