Skip to content

Instantly share code, notes, and snippets.

@JacksonTian
Created September 8, 2011 04:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JacksonTian/1202575 to your computer and use it in GitHub Desktop.
Save JacksonTian/1202575 to your computer and use it in GitHub Desktop.
各种移动设备的viewport取值
Devices landscape(w/h) portrait(w/h)
HTC g10 533/260 320/473
ipad1 1024/690 768/946
ipad2 1024/690 768/946
Samsung9100 533/237 320/450
Samsung9000 533/239 320/452
LePhone 533/250 320/463
ipod(4.2.1) 480/208 320/356
//以下数据来自支付宝 颂赞
MOROTOLA ME722 320/488 569/239
HTC Mozart T8698 windows phone 480/320 320/480
HTC G12 533/267 320/480
HTC G3 480/264 320/480
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<title>Viewport</title>
<script>
window.addEventListener("load", function (ev) {
var orientationchange = function () {
var orient = Math.abs(window.orientation) === 90 ? 'landscape' : 'portrait';
document.body.innerHTML = orient + " : " + window.innerWidth + " / " + window.innerHeight + "<br />" + navigator.userAgent;
};
window.addEventListener('orientationchange', orientationchange, false);
orientationchange();
}, false);
</script>
</head>
<body>
测试前提:
width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;
测试方法:
用移动设备打开,非home screen模式。
横屏,记下landscape模式的width和height的值。
竖屏,记下portrait模式的width和height的值。
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment