Is there a way to modify the background color or opacity of a specific area within an image?
Take a look at my HTML, JavaScript, and CSS:
function changeColor()
{
document.getElementById('testid').setAttribute("class", "style1");
}
.style1{
background: red
}
<img src="http://mridulahuja.com/uploads/1/3/8/6/13860206/_____2659642_orig.jpg" alt="" usemap="#Map" />
<map name="Map" id="Map" href="www.mridulahuja.com">
<area alt="" title="" href="#" shape="poly" id="testid" onlcick="changeColor()" coords="117,36,162,20,193,34,189,55,108,55" />
<area alt="" title="" href="#" shape="poly" coords="33,93,33,119,32,143,32,169,32,186,31,191,94,194,123,194,149,193,164,193,158,119,186,119,216,118,227,115,224,82,103,83,31,82" />
</map>
I experimented with using opacity but nothing seemed to have any effect. Any suggestions on how to achieve this?
Check it out on jsfiddle