J
J
jamster2021-06-28 13:52:15
JavaScript
jamster, 2021-06-28 13:52:15

How to revive an image?

Hello.
60d9a9ab0f5c5085426632.png
There is such a layout, there are letters, on hover the house should be highlighted.
A modal window should open on click.
What technologies to use to achieve the goal?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Maxim Morev, 2021-06-28
@SeaInside

Advise ... Change backgrounds - forget it. HTML area - also bury.
Take your picture. On top of the buildings create a vector path (circle the buildings).
Mark up the drawn paths as you like, it will be enough to hang a class for further styling by hover + significant information for the tooltip / click / whatever else in the data attributes.

<svg ...>
  <path class="area" data-id="1" d="..." />
  <path class="area" data-id="2" d="..." />
</svg>

Inline the resulting structure onto the page. The background can be in a separate element and the map on top, you can sew it directly into SVG - it doesn’t matter.
On the hover on the path - through CSS you make it a translucent fill, judging by the picture, it just fills with a solid color on hover - the easiest option.
By clicking on the path - get its `data-id` and display some information.
Here is an example of an article that describes in more detail.
https://css-tricks.com/svg-map-rollovers/
There is an interactive example at the end.
The fundamental difference with your task is that you initially need paths with no fill and an image below them.

S
Sergey Sokolov, 2021-06-28
@sergiks

In Adobe Illustrator, draw contours and plates and info over the hulls, save a copy as .. SVG. Take the code and paste it into HTML. Display over bitmap.
Give an id to the outline and plate shapes. Do not confuse, as I did: the plates come out for the wrong contours.
JS can use these id's to access SVG elements as normal HTML elements, and listen for events on them. Highlight the contour on mouse over, show the sign brighter:

A
Artem, 2021-06-28
@artemky

Ready source solution

S
Stalker_RED, 2021-06-29
@Stalker_RED

In svg, put your picture as a background, place contours on top of the houses,
here is an elementary example:

And here, without an SVG editor, you can simply click on the image with the mouse to get the coordinates for the outline.
jsfiddle.net/Stalk/kLvnc9ru

3
33remido, 2021-06-28
@33remido

I would track the position of the cursor and just change the background to a picture where the house is highlighted. But it's probably too resource intensive.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question