Question

I have a round image which I managed to find how to map in a previous question. I now wonder how I can make this image change when i hover over it. It has a mapped area. I have a problem on that.

HTML version without CSS where i believe that the " usemap="#imagechange" " is causing the problem:

 <img src="1.png" 
     onmouseover="this.src='2.png'" 
     onmouseout="this.src='1.png'" 
     width="100" height="100" 
     alt="usemap" border="0" 
     usemap="#imagechange"/>
 <map name="imagechange">
     <area shape="circle" coords="50,50,50" href="image.com"  />
 </map>

It works only when I am inside the area (= 100x100 area MINUS the circle area). I also have a version with css which doesnt work at all.

HTML version with CSS:

div class="imagechange" > 
<img src='foundation/images/Twitter.png' 
          title="Map Image" 
          alt="usemap" border="0"
          usemap="#imagechange"/> 
<map name="imagechange">
    <area shape="circle" coords="50,50,50" href="index.html"  />
</map>

CSS

      .imagechange {
 width: 100px;
 height:100px;
 display:block;
 overflow:hidden;
 border-radius:50px;
 -webkit-border-radius:50px;
}

.imagechange:hover {
 border-radius:0px;
 -webkit-border-radius:0px;
} 
Was it helpful?

Solution

Use this:

<a href='http://www.google.com/'>
    <img src='1.png' onmouseover="this.src='2.png'" onmouseout="this.src='1.png'" style='border:0px; border-radius:999px; -webkit-border-radius:999px;'/>
</a>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top