javascript - SVG mobile orientation change -


i'm working on svg , far well, except 1 issue.

normally, in absence of width/height attributes on root element, svg scale fill viewport.

however on mobile, notice changing orientation breaks functionality. when rotating portrait landscape, original screen width becomes width of viewport , svg goes way off bottom. rotating gives opposite problem, resulting in small svg.

this not happen on desktop, when resizing browser window - svg correctly adjusts scale fills available space.

how can force svg scale recalculate correctly when screen orientation changes?

the issue has been resolved forcing redraw. can done performing operation causes svg change somehow, if "change" no-op.

in case...

window.addeventlistener('resize',function() {     svg.setattribute("x",0); }); 

... worked fine.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -