4

The problem I have about using the map & area tag is that I havent been able to find out a solution to having "holes" in the area, for example imagine a lake on map, you dont want that area to be clickable.

Example code:

http://jsfiddle.net/WbKqS/

In this example I have placed 3 lakes on the map but I dont want the lakes to have the hovereffect/being clickable, is this possible? Maybe with another technique?

Richard Ev
  • 52,939
  • 59
  • 191
  • 278
Johan Svensson
  • 863
  • 3
  • 9
  • 23

4 Answers4

2

HTML areas don't support having holes or multiple sets of coords, so you'll need to go with a workaround.

How about a solution based on the approach illustrated below?

area with fake hole

Richard Ev
  • 52,939
  • 59
  • 191
  • 278
  • That is an idea, is it however possible to hide the lines at the "end" of the shape? So it looks like a solid shape. – Johan Svensson Dec 21 '11 at 11:26
  • This is a good idea, is it however possible to have a border around it somehow? On both the inside and outside? – Johan Svensson Dec 21 '11 at 13:44
  • Not with this approach, no. You could however have two copied of your map image; one in the "normal" state, one with a border. You would need to display the image with a border on mouseover. For a smooth user experience you would want to either preload the bordered map, or use CSS sprites. However you would no longer need to use maphighlight if you did this. – Richard Ev Dec 21 '11 at 14:01
1

I don't think this is a good idea to develope this using area map. I would use Raphael instead. a map example with Raphael

defau1t
  • 10,593
  • 2
  • 35
  • 47
0

I wish it worked that way, but it does not as of right now. Try using SVG format instead. That's Scalable Vector Graphics technology. SVGs support holes and multiple shapes or islands if you will. Hope this helps, it helped me in Firefox. If that method fails, I'll look into using <canvas> tag.

jdoe
  • 1
  • 1
0

You could position other 'hidden' (div) elements over the lakes, preventing the hover effect from being triggered. Disadvantage is shape of the elements (square). Using canvas could be a solution for that, but not all browsers support it.

Chris Laarman
  • 1,559
  • 12
  • 25