HTML Image Map Hotspots
Firstly you need to have an image file. So find your image file and have it ready.
The first bit of code will be:
CODE
<!-- Change details as required -->
<img src="image.gif" alt="image" usemap="#mymap" width="600" height="650" />
<map name="mymap" id="mymap">
Please be aware that the usemap="#mymap" is required in the img section to select which map the image uses. Change the name of the map to the name of the one which needs to be used but keep the # where it is.
Now to select image map hotspot areas you have to decide on the type of image hotspot you need.
This can either be a Rectangular Hotspot, Circular Hotspot or a Polygonal Hotspot.
The top left of the image is coordinates (0, 0). The first value being the x value and the second value being the y value. As you go further to the right of the picture the x value increases. As you go further to the bottom of the picture the y value increases.
Rectangular HotspotWith a rectangular hotspot you will need the coordinates of the top left corner (x1, y1) and the bottom right corner (x2, y2) of the hotspot.
the code for the rectangular hotspot is
CODE
<!-- Change details as required and also add the coorinates in the appropriate places -->
<area shape="rect" coords="x1,y1,x2,y2" href="http://www.somewebsite.com" alt="Some Website" />
Circular HotspotWith a circular hotspot you will need the coordinates of the circles center (x, y) and the radius of the circle ( r ).
the code for the circular hotspot is
CODE
<!-- Change details as required and also add the coorinates in the appropriate places -->
<area shape="circle" coords="x,y,z" href="http://www.somewebsite.com" alt="Some Website" />
Polygonal HotspotThe polygonal hotspot is great for the hotspots which have weird or unique shapes. It gives you the ability to select as many boundary points (x, y) you wish which followed make the outline of the hotspot. Please make sure the points are in the order in one direction around the hotspot.
the code for the polygonal hotspot is
CODE
<!-- Change details as required and also add the coorinates in the appropriate places.
Please DO NOT leave the ", ..." in the coords section, it has been used to show that you can add more -->
<area shape="poly" coords="x1,y1,x2,y2,x3,y3, ..." href="http://www.somewebsite.com" alt="Some Website" />
the end part after the hotspots are added is
CODE
</map>
Now a full copy of the code required using one of each type of hotspot. I will show this example using fake coordinates.
CODE
<img src="image.gif" alt="image" usemap="#mymap" width="600" height="650" />
<map name="mymap" id="mymap">
<area shape="rect" coords="400,450,500,520" href="http://www.somewebsite.com" alt="Some Website" />
<area shape="circle" coords="300,250,10" href="http://www.somewebsite.com" alt="Some Website" />
<area shape="poly" coords="0,0,175,0,160,55,165,75,140,60,140,80,100,190,110,220,100,240,35,225,0,210"
href="http://www.somewebsite.com" alt="Some Website" />
</map>
There can be as many hotspots on the picture as you wish.
Good Luck!
