views:

66

answers:

1

Hi all:

There is a web application for me to build, and rather than image map, I would like to try something more elegant.

The story is, there gonna be a global map where different continents are denoted by different colors.

Say Australia is red and Asia is green.

Will there be a way that when my mouse is hovering on the shape of Australia that my code will tell me that I am hovering on Australia by checking for the color where my cursor is currently pointing at?

I know I can check for mouse coordinates on image or something else, but I really want to get something that is not depending on pre-defined values/shapes/margins.

Any idea and suggestion would be much appreciated. Thanks a lot in advance.

+5  A: 

It depends on what kind of element your map is. It is definitely possible for certain elements in browsers that support canvas, but not for the whole page.

See the answers to my similar question: JavaScript eyedropper (tell colour of Pixel under mouse cursor)

Pekka
thanks a lot for this quick answer, let me go and have a check!
Michael Mao
Bingo! You got it answered already, sort of.
Michael Mao