码迷,mamicode.com
首页 > 移动开发 > 详细

让HTML页面缩放适应移动客户端尺寸

时间:2015-02-01 11:59:48      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

多的不说了,直接看代码吧

<html lang="en">
<head>
	<meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-touch-fullscreen" content="YES" />
	<script type="text/javascript">
	var w =  screen.width;
	var rate = "0.55";
	switch(w){
				case 320:
                case 640:
                    rate = "0.5";
                    break;
                case 365:
                case 720:
                case 375:
                case 750:
                    rate = "0.585";
                    break;
                case 414:
                case 1242:
                case 1080:
                    rate = "0.64";
                    break;
                default:
                    rate = "0.55";
                    break;
	}
	document.write("<meta name=‘viewport‘ content=‘width=device-width,initial-scale="+rate+", minimum-scale=0.2, maximum-scale=1, user-scalable=no‘>");
	</script>
	<meta charset="UTF-8">
	<title>DEMO</title>
	<!-- atwind | ChaosStudio http://cszi.com -->
	<link rel="stylesheet" href="css/normalize.css">

  。。。。

后面的就略掉了。

让HTML页面缩放适应移动客户端尺寸

标签:

原文地址:http://www.cnblogs.com/atwind/p/4265354.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!