Answers for "svg auto size"

0

svg auto size

// Javascript to run after document load
var svg = document.getElementsByTagName("svg")[0];
var bbox = svg.getBBox();
svg.setAttribute("width", bbox.width + "px");
svg.setAttribute("height", bbox.height + "px");
svg.setAttribute("viewBox", `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`);
Posted by: Guest on March-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language