Seeking advice on the best way to implement a new feature.
I have an SVG
map with tiny blue icons that users can click on. You can refer to the image below for clarity:
https://i.sstatic.net/XHry9.png
Whenever a user clicks on any of these blue icons, I want a small modal to pop up showing information about that specific region. Take a look at the screenshot below as an example:
https://i.sstatic.net/vRv3X.png
For instance, in the screenshot above, clicking on the blue circle at the bottom brings up a modal displaying details about that particular region.
In my svg
, I've assigned ids to each blue icon (
<g class="mapLocations__icon" id="uk" ..."
>. However, I'm currently contemplating two options:
- Absolutely positioning the modals for each region, but this could be challenging to make responsive.
- Repeating markup for the modal within the
svg
itself.
Both approaches don't seem ideal to me.
Any suggestions on how to proceed?
Here is the link to view my svg
code: https://jsfiddle.net/6squyc7d/ (Shared via jsfiddle due to character limit when pasted here)