Hi I'm pretty new to js and I don't understand very well how svg is supposed to work.
I have generated a svg file I want to use in the webpage. The file is quite big and I don't want to paste it inline, because I want to be able to replace it with another one. I also need to have access to it's elements so, AFAIK, the only option is to load it as <object>
instead of as <img>
However I'm finding a lot of caveats when I load it in this way.
One of them is the drawing order when I want to add more svg layers over the object.
If I write the elements in this order
blue circle svg
object
green circle svg
I see the blue circle over the object and the green circle NEXT to the object (as if it was pushed by the object). I would expect to see the first element I drew in the background and the last one on the front.
<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg">
<circle id = "AGV01R" cx = "140" cy="100" r = "20" fill = "blue"></circle>
</svg>
<object type = "image/svg+xml" data="http://upload.wikimedia.org/wikipedia/commons/5/57/Weakness_of_Turing_test_1.svg" class="plano" id="plano"></object>
<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg">
<circle id = "AGV02R" cx = "140" cy="100" r = "15" fill = "green"></circle>
</svg>