ThemeShaper Forums » Thematic

[closed]

Initial scale for iPhone/Android

(2 posts)
  • Started 3 years ago by amzero427
  • Latest reply from amzero427
  • This topic is not a support question
  1. amzero427
    Member

    First of all, just wanted to say thanks to everybody for the thematic forums and all their input!

    I have a question about changing the content width and initial scale for viewing on an iPhone. Apparently, to adjust for iPhone, the tags look something like this:

    <meta name="viewport" content="width = 320" />
    <meta name="viewport" content="initial-scale=2.3, user-scalable=no" />

    I was wondering if their was a way to set a function using javascript, either in the functions.php or the header.php, that can set the initial scale only when the device is an iPhone or Android device, but leave it alone otherwise? I took a stab with

    <script type="text/javascript">
     function setViewPortWidth(width) {
        if((navigator.userAgent.match(/AppleWebKit\/(.*)Mobile\//))||(navigator.userAgent.match(/Android(.*)Mobile/))) {
    
        element.setAttribute('content','width = 320'; 'initial-scale = 2.3, user-scalable = no');
        document.body.style['max-width'] = width'320';
       }
      }
     }
     </script>

    Which totally didn't work and probably looks ridiculous to anyone who's not a noob like myself. But am I at least on the right track? Or is this an all together bad idea?

    Posted 3 years ago #
  2. amzero427
    Member

    I'm changing this to not a support question. After some time, I decided to go with an alternate css for mobile devices instead of trying to find a way to alter the initial scale, but if anyone does find a way to do this I'd love to hear it. Gotta say though, I was reluctant to go the css route, but it was much less time consuming than I imagined, and with a fluid/responsive layout it works great:

    http://forums.themeshaper.com/topic/responsive-web-design-and-thematic

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.