The href attribute is supposed to be a URL, so is there some way to replace the image with a data image?
How do I change the attributes? I tried s.SVGImageElement.x = "-43.28%";
but I get an error: There was an error: TypeError: Cannot set properties of undefined (setting ‘x’)
Once the page loads an AJAX request fires and gets a screenshot of another page and returns the screenshot as a data image. That all works. What doesn’t work cos I’m not sure how to do it, is replacing the image that’s there with the returned data image.
If it’s already a properly formatted data uri, you should be able to just write it in as the HREF of the image tag.
Which leads us back to #2.
I assume ‘s’ in your opening post is a reference to the SVG element.
the image is a tag inside the tag. So you could s.getElementsByClassName or s.getElementsByClassName or s.children, reference the 0th element of the set, and then modify the x parameter in the following way:
s.children[0].x.baseVal.value
Alternatively (and the way that the CSS guys would prefer me to tell you), apply a transform:translate to the element.