Relative Content

Tag Archive for javascriptcsssvg

SVG element calculated position is wrong when svg is not its viewBox size

I have an svg map displaying countries. I want to create an svg element that gets the same position of the selected country as overlay an element. Thing is that it only gets the accurate position when the size matches with the viewBox size and this even works resizing, but the problem arises when it calculates in smaller screens or when the svg is streched above its viewbox size. Then it’s inaccurate.