1

Well does anyone know of a javascript that detects whether a user is using a mobile phone or a normal computer and then resizes the window to fit that device, if it cant be done with javascript does anyone know a way in which it can be done.

Thanks for any help that ye can give

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
AlanF
  • 1,591
  • 3
  • 14
  • 20
  • possible duplicate of [Detect iPhone/iPad purely by css](http://stackoverflow.com/questions/3839809/detect-iphone-ipad-purely-by-css) – Quentin Jan 25 '12 at 12:11

2 Answers2

2

Nice article from smashing magazine

http://coding.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/#more-50749

eq.

 @media only screen and (max-device-width: 480px) {
        // insert styling here… 
 }
user956584
  • 5,316
  • 3
  • 40
  • 50
0

I use these:

/* Non-Retina */
@media screen and (-webkit-max-device-pixel-ratio: 1) {
}

/* Retina */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
}

/* iPhone Portrait */
@media screen and (max-device-width: 480px) and (orientation:portrait) {
} 

/* iPhone Landscape */
@media screen and (max-device-width: 480px) and (orientation:landscape) {
}

/* iPad Portrait */
@media screen and (min-device-width: 481px) and (orientation:portrait) {
}

/* iPad Landscape */
@media screen and (min-device-width: 481px) and (orientation:landscape) {
}

http://zsprawl.com/iOS/2012/03/css-for-iphone-ipad-and-retina-displays/

zSprawl
  • 969
  • 7
  • 11