user3435508
user3435508

Reputation: 13

Creating buttons on an image in HTML5

I am creating a website of a map of South-East Asia. I want the user be able to press on country on the map and a pop up box will come up showing information of the country pressed on.

How will I make the buttons on the map work? I have tried to transparent the countries in different images and overlay them in HTML and CSS however this did not work

Upvotes: 0

Views: 98

Answers (4)

cyborg86pl
cyborg86pl

Reputation: 2617

I'd try to solve this with SVG.

It gives you not only an ability to define complex shapes (and also export code from ex. illustrator) but also to make your UI more user-friendly (color overlays, outlines etc).

Upvotes: 0

notchris
notchris

Reputation: 180

As stated above, the most common method of doing this is by using an image map. However, if you would like an alternative that is a little more interactive you could use jQuery. There are a number of jQuery map / floorplan plugins that can achieve this elegantly.

Here are a few I have found from a simple Google search:

JVectorMap - visit

mapSVG - visit

JQVMAP - visit

I hope this helps!

Upvotes: 0

Donal
Donal

Reputation: 32713

You need to use an image map. Have a look here

Upvotes: 2

Pierre Granger
Pierre Granger

Reputation: 2012

img map area are exactly for this. You can mix it with css and js if you need to add/remove classes on hover, like hide/show the country hover.

Upvotes: 0

Related Questions