-1
<img id="Imag" usemap="#Calculadora" width="100%" height="auto" src="Calculadora.png">
<map name="Calculadora">
<area class="mapa" onclick="teste()" coords="252,953,647,1379" shape="rect">
<area class="mapa" onclick="teste()" coords="746,952,1141,1375" shape="rect">
<area class="mapa" onclick="teste()" coords="1258,954,1644,1377" shape="rect">
<area class="mapa" onclick="teste()" coords="1752,941" shape="rect">
<area class="mapa" onclick="teste()" coords="252,1469,638,1883" shape="rect">
<area class="mapa" onclick="teste()" coords="746,1465,1132,1879" shape="rect">
<area class="mapa" onclick="teste()" coords="1258,1465,1644,1879" shape="rect">
<area class="mapa" onclick="teste()" coords="2156,745,2381,988" shape="rect">
<area class="mapa" onclick="teste()" coords="1752,1469,2138,1883" shape="rect">
<area class="mapa" onclick="teste()" coords="252,1976,638,2390" shape="rect">
<area class="mapa" onclick="teste()" coords="746,1980,1132,2394" shape="rect">
<area class="mapa" onclick="teste()" coords="1258,1976,1644,2390" shape="rect">
<area class="mapa" onclick="teste()" coords="1752,1982,2138,2396" shape="rect">
<area class="mapa" onclick="teste()" coords="252,2482,638,2896" shape="rect">
<area class="mapa" onclick="teste()" coords="746,2484,1132,2898" shape="rect">
<area class="mapa" onclick="teste()" coords="1258,2486,1644,2900" shape="rect">
<area class="mapa" onclick="teste()" coords="1752,2484,2138,2898" shape="rect">
</map>
How can I make this image’s Mapping responsive to the image? Because the way the code is written, the mapping is entirely wrong depending on the display/screen resolution.
Image I am using: https://imgur.com/a/5c5Y0WG
NOTE: I tried using percentage instead of pixels, but it didn’t work.
Example: The following image has 500px of width and height, the coordinates of the square in the center is: 159,159,342,342. Using percentage stayed: 31.80%,31.80%,68.40%,68.40%(To define the value of the first percentages I made a rule of three, 500 was to 159, as 100% was to x)
And by doing so, it didn’t work.
The code of this example was thus:
<img id="Imag" usemap="#Calculadora" width="100%" src="AAAA.jpg">
<map name="Calculadora">
<area class="mapa" coords="31.80%,31.80%,68.40%,68.40%" shape="rect">
</map>
Note: If in the example above I do: coords="159%,159%,342%,342%"
works, but does not get responsive, if the image has its change, the link gets in the wrong place.
Tip https://www.zaneray.com/responsive-image-map/
– hugocsl
@hugocsl tried to use this site, but I didn’t understand where to put the code that he made available to me.
– JAMDev