html - How to hotspot a resizable image? -


I want to hotspot the areas in the image displayed on an html page. Although this image changes the width and height based on the display screen:

  & lt; Img height = "100%" width = "100%" src = "img.png" />   

How would I do this hotspot? I was thinking about a function that maps to the original coordinates of the resized image again. You can move the image and hotspot in a relatively situation and then use the percentage to create the position of the hotspot:

CSS

  Hotspotted {status: relative; } .hotspot {display: block; Status: Completed; } #hotspot1 {height: 81%; Left: 9%; Top: 16%; Width: 45%; } #hotspot2 {height: 18%; Correct: 11%; Top: 20%; Width: 11%; }   

HTML

  & lt; Div class = "hotspotted" & gt; & Lt; Img height = "100%" width = "100%" src = "img.png" /> & Lt; A href = "#" id = "hotspot1" class = "hotspot" & gt; & Lt; / A & gt; & Lt; A href = "#" id = "hotspot2" square = "hotspot" & gt; & Lt; / A & gt; & Lt; / Div & gt;      update   

If you are going to use a map, then I suggest that the percent Instead of using it, you calculate the new coordination. This can be done very easily using the following equation:

  new_x = (orginal_x / original_image_width) * new_image_width new_y = (orignal_y / original_image_height) * new_image_height    

Comments