piquemouche/assets/js/svg-fix.js

19 lines
548 B
JavaScript
Raw Permalink Normal View History

2024-02-13 15:33:43 +01:00
// SVG map fix
(function() {
var allItems = document.querySelectorAll('use');
for (var i = 0; i < allItems.length; i++) {
var item = allItems[i];
var anchor = '#' + item.getAttribute('xlink:href').split('#')[1];
var itemData = window.publiiSvgFix[anchor];
if(!itemData) {
console.log('ANCHOR', anchor, i);
continue;
}
var svgItem = item.parentNode;
svgItem.innerHTML = itemData.content;
svgItem.setAttribute('viewBox', itemData.viewbox);
}
})();