3 ms·
> Anchors positioned absolutely over my map wouldn’t solve the pixel-based positioning problem or give me the irregular-shaped clickable areas I wanted. Anchors
by seabass 1y ago
> Anchors positioned absolutely over my map wouldn’t solve the pixel-based positioning problem or give me the irregular-shaped clickable areas I wanted. Anchors within an external SVG wouldn’t work either.
If you're trying something like this and irregular-shaped clickable areas are not a concern (like if only the numbered circles from the article's example would be clickable) then absolutely positioned anchors can be made to work. The trick is to use js to apply a css scale transformation to a relatively positioned parent container whenever the underlying image changes size.
- abanana 1y agoMy thought when reading that in the article was (in cases where, as you said, irregular-shaped clickable areas are not a concern): why do we need pixel-based positioning? What's wrong with percentage-based positioning and sizing? I did exactly that a couple of years ago, and it worked as expected.