javascript - Click on different transparent PNG's. Which one is clicked? -
I am trying to prepare a map of the country, which is divided into different provinces. When my products are available in some provinces, these provinces will get light on the map. I want people to select a province and click on it.
I am thinking of doing this: 1) I have the background of whole country in dark colors 2) Every province is a different transparent PNG in a light color 3) When my database is a product address This background image will show a light color image of each province
The problem is: I want a light color clickable image, but the canvas of all the images will overlap. Is there any way to accomplish this ? It should work in all major browsers, and preferably not with the image map. I want to link the clickable area to the non-transparent part of the PNG image.
I hope this will understand a little bit, thanks a lot in advance.
An option has just created your Because the canvas can do this to get the pixel color under the mouse. Although he & lt; IE8, maybe you can see it in explorercanvas, otherwise you can save it to the server, simply click on an AJX request with your relative (relative!) X, your backend can understand it again. world image, and another
Hittest image, where all the states are a different color when the user clicks somewhere, you can only get the color of the clicked pixel, and tell the province back. So your
hittest picture, for example, Texas will be in red, blue as California and when you click on New York as Green, you have to find out the color, And there you have your state.
Comments
Post a Comment