I am trying to stretch an svg document inside the DOM to fit the window size.
So:
<div id="y"> <div id="button"> click to zoom</div> <embed id="x" src="s17.svg" > <script> var btn= document.getElementById("button"); btn.addEventListener('click',function(){ var z= document.getElementsByTagName("embed")[0]; var y = z.getSVGDocument(); y.lastChild.setAttribute("viewBox","0 0 "+window.innerWidth+" "+window.innerHeight); },false); </script> </div>
CSS
#x{ height:100%; width:100%; overflow:hidden; } #y{ position:absolute; top:0; bottom:0; left:0; right:0; overflow:hidden; }
This does not work ... What am I doing wrong?
fogy source share