R
R
Roman Misyura2013-08-02 09:33:40
css
Roman Misyura, 2013-08-02 09:33:40

Cursor responsive on transparent pixels or shapes (SVG/PNG)?

Actually there is a map: It is
thumb.png

necessary to place regions on the map so that they react to the borders of regions. Those. the first option is made through imagemap. Further I think to pull up a script through areas div'y from above. But get a problem. If you insert a div, then it is straight or square, then other areas do not react to the hover. The question is, is it possible to put an SVG area or a PNG in such a way that the cursor only reacts to an object where there is a fill. (Did not react to transparent areas or areas where there is no shape)

oblas.png

I.e. react to the object, but do not react to the zone where the red arrows are.

jsfiddle.net/DgThK/

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
krasulya, 2013-08-02
@MindMinimal

I did roughly the same thing with raphaeljs.com/ (which is SVG). I made the necessary shapes in Illustrator and exported them to SVG. And Raphael drew. Events are perfectly supported, incl. click, hover. If you want, I can even send you what I did.
You can do this with canvas too.
I wouldn't use imagemap. Too complex shapes for the areas, too laborious.

A
Anton Bobylev, 2013-08-02
@dpigo

Maybe this will help:
stackoverflow.com/questions/11236085/create-a-map-with-clickable-provinces-states-using-svg-html-css-imagemap
The answers there discuss plugin for jQuery and implementation via svg and xslt

D
dima_horror, 2013-08-02
@dima_horror

Look, is this what you are looking for?
bcrl.org.ua/map.html
I implemented this. If that's what it is, I'll tell you.

M
Makito, 2013-08-02
@Makito

Make your map image a background to the block of the desired width and height, put an image of a one-pixel transparent gif on top, which is stretched to the full width and height, and already apply the imagemap map to this image, then the cursor will adequately respond only to the contour part of the area, and the filled area show below this transparent hyphae layer.
This is if done on maparea. But it’s easier to do it on raphaeljs, where you can simply do data manipulation and load data into json and a lot of all sorts of goodies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question