Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 158

stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
11/16/13 12:34 PM (12 years ago)

Different Viewports for Iphone and Ipad

I have an html file with javascript which operates as I wish on the iphone in my BT app. I have this declaration in the head: <meta name="viewport" content="width=device-width initial-scale=.3 maximum-scale=.3"> However, on the ipad, this doesn't work and I'd rather not have this declaration in AT ALL since when it's not in, things work as I wish on the ipad. Is there a way I can have one set of viewports for one device and another for another device? Thanks. Steve
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
11/16/13 02:12 PM (12 years ago)
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
11/16/13 02:46 PM (12 years ago)
Thanks for the help. I Actually found this elegant, JQuery method searching the web - This goes in the beginning of the head as a default for my ipad: <meta name="viewport" content="width=device-width initial-scale=.8 maximum-scale=.8 user-scalable=no"> And this goes later on to detect a smaller device: <script> if ($(window).width() < 600) { $('meta[name=viewport]').attr('content','initial-scale=0.35, maximum-scale=0.35, user-scalable=no'); } </script> I had to play around with the numbers on each device to go with my content but it works.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.