I am able to get SVG to center in the iPad if I create a parent SVG element containing no viewBox with a child SVG that does contain a viewBox. For example, the viewBox in this SVG works well in portrait orientation and fills the screen if I also size the SVG to these dimensions:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" baseProfile="full" version="1.1" onload='Init(evt)'> <svg id="SVG1" viewBox="0 0 504 604"> ... </svg> </svg> To fill the screen in a landscape orientation, this viewBox works well for me: viewBox="0 0 721 465". The viewBox can be sized to other dimensions and it will then center it on the iPad. Hope this helps, Donna --- In [email protected], "jamesd" <jcdeering1@...> wrote: > > Just returned from the Apple store where my efforts failed. I am trying to > figure out how to get an SVG file to load properly in iPads and iPhones. > Currently Apple has a non-standard viewbox setting which loads the SVG in the > middle of the page layout. This means that you have to scroll down to find > the file which is not desirable. > > Does anybody have a solution? SVG files should load to the device at the top > of the display, but they don't. > > I tried this javascript that I found without success. > > <script type="text/javascript"> > var updateLayout = function() { > if (window.innerWidth != currentWidth) { > currentWidth = window.innerWidth; > var orient = (currentWidth == 320) ? "profile" : "landscape"; > document.body.setAttribute("orient", orient); > window.scrollTo(0, 1); > } > }; > > iPhone.DomLoad(updateLayout); > setInterval(updateLayout, 400); > </script> > > Your help is greatly appreciated. > > James > http://deerring.com > ------------------------------------ ----- To unsubscribe send a message to: [email protected] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

