Responsive Image Maps in Blocs - How To Guide

Hi all, I’m slowly shifting my personal website over to Blocs from a different system. One element I have is an infographic image map. I’ve seen discussion on here with folk asking to do it. I experimented as I wanted an accurate and responsive browser responsive image map solution so all it all resizes in the browser and great news is it is dead easy and available straight out of Blocs with standard functions and no fancy coding or extras needed. Here is a rough and ready example I’ve knocked up to experiment with, as still working on my infographic.

The idea is a responsive image, responsive sizing of the markers, the markers pulse to invite people to click, it opens a modal. This can be bashed about to do other things if needed.

It’s all about Relative positioning of a DIV with an image in and then Absolute positioning of the SVG markers. Then instead of using pixel values it is about using percentages.

Here are the steps:

Place your image inside a DIV and set its position to Relative with a class, the DIV that is, not the image.
Add an Icon and to Absolute position using a class.
In this class position each hotspot using Edge in the class set to percentages.
Repeat for more hotspots.
Assign each icon an animation if you want such as pulse loop infinite.
Create a modal for content
Assign an Interaction to open a Modal

Have a look at the demo file, you will see what I mean. When you do it a couple of times it’s dead easy.
Also position your hotspot you just change the top and left value of it’s position by experimenting with percentage values.

It will all be responsive. If you want your actual icons resize responsively also then change their size from a pixel value to a percentage value.

Resize your browser window to see it all scale responsively.

Image hotspots, all part of Blocs out of the tin.

Hope this helps those that want image hotspots.

Tah

Ben

Image Map.bloc (197.4 KB)

10 Likes

Hey @SpookyDoo

Great work and very generous of you to post this bloc showing your work!

I was looking at some point to do something like this for an event stage and when you clicked on lights or speakers or even the back drop a modal pops up with information on it…this is perfect !

Thanks for sharing and again showing that Blocs can create nearly anything with the tools we have.

1 Like

Thanks @AdieJAM I’ve had great help from folk since since switching to Blocs last Oct/Nov, folk have taken time to help, that it seems only fair when ‘discovering’ something to share back if it could be useful.

I’m just amazed how much can be done with Blocs straight out of the tin. Or if a feature or function isn’t possible how easy it is to add custom code to do something.

3 Likes

You had me at Millennium Falcon!

Thanks for showing us your workings, great stuff. Appreciate it.

2 Likes

Thank you so much for sharing, this will help me a lot.

1 Like