Loading multiple SVG with svg-overlay
See original GitHub issueGood Morning, I am using the svg-overlay.js component to load an SVG. My question is : If I need to load multiple SVG do I need to create multiple SVG overlays aswell or there is a cleaner way to achieve it? Thanks you so much for any guidelines. This is the code I am using to load one svg:
// LOAD SVG
var svgOverlay = viewer.svgOverlay();
var path = 'images/money.svg';
function loadSVG(path, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(e) {
try {
if (xhr.readyState == 4 && xhr.status == 200) {
callback(xhr.responseXML.documentElement);
}
} catch (e) {
console.log(e);
}
};
//
xhr.open('GET', path, true);
xhr.overrideMimeType('text/xml');
xhr.responseType = 'document';
xhr.send();
}
loadSVG(path, function(data) {
var g = data.getElementById('moneyG');
svgOverlay.node().appendChild(g);
}); // END LOAD SVG
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Loading an external SVG file. · Issue #29 - GitHub
Hi, Is it possible to load in "rect" an external SVG file instead of an image? ... No matter how many tryouts ive...
Read more >Multiple svg files overlay - Stack Overflow
There is no built-in functionality to have multiple overlaid SVGs. One way to achieve that (probably the easiest) is by using synchronised ...
Read more >Fits image with svg overlay
Fits image with svg overlay ... setupControls(); // Load array representation of image webfits.loadImage('some-identifier', arr, width, ...
Read more >Managing SVG Interaction With The Pointer Events Property
Let's take a look at how to shape the interactivity of SVG images — that is, control which parts of the document can...
Read more >Building SVG Components with React.js and d3.js - pganalyze
Learn how to use SVG with React and d3, what SVG is, when to use it, handling, sizing, styling, layouting and interactivity in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And we appreciate it. 😉 From this chaos and sadness some things have to turn into positive things… Greetings from France.
Closing this, feel free to re-open if there’s any issues!