Hacker News new | ask | show | jobs
by perilunar 2224 days ago
If image maps only allowed rectangular areas, they wouldn't be terribly useful — you're right that it would be almost as easy to lay some transparent divs over the image.

However... image maps also allow for circular and polygonal regions, which can be really handy.

I guess you could also do that with a transparent SVG overlay, but using a map is easier.

1 comments

Right, but in this example, the author is laying divs on top of the map areas, and those need to be rectangles.
The annotation divs have to be rectangles, but the mouse/touch-sensitive areas of the underlying image don't! The author's goal is to only show an annotation if the user hovers over/touches its corresponding region in the image map.