I try to import old project written in Emberjs to new angular2 project. In emberjs my previous mate was loading external svg file like this:
<object id="svgobj" class="scaling-svg" data="/images/monitor.svg?v=3"
type="image/svg+xml"></object>
And then in JS
this.$('#svgobj')[0].addEventListener('load', function() {
_snap = Snap("#svgobj");
self.registerCpuUsageControllerEvent();
svgTooltip(_snap);
self.go();
});
I didn't like this way and I tried to load svg like this:
<div id="svgobj" class="scaling-svg"></div>
JS:
Snap.load("/images/monitor.svg", (loadedFragment => {
$("#svgobj").append(loadedFragment.node);
this._snap = new Snap("#svgobj svg");
this.svgObj = true;
this.start();
}));
But now it doesn't work in Firefox.. Two screenshots below.
Aucun commentaire:
Enregistrer un commentaire