使用meta tag "viewport"
viewport标签包含如下属性:
复制代码 代码如下:
<meta content="width=device-width, maximum-scale=1.0" />
复制代码 代码如下:
<script type="text/javascript">
var updateLayout = function() {
if (window.innerWidth != currentWidth) {
currentWidth = window.innerWidth;
var orient = (currentWidth == 320) ? "profile" : "landscape";
document.body.setAttribute("orient", orient);
window.scrollTo(0, 1);
}
};
iPhone.DomLoad(updateLayout);
setInterval(updateLayout, 400);
</script>
复制代码 代码如下:
<link media="all and (orientation:portrait)" href="portrait.css">
<link media="all and (orientation:landscape)" href="landscape.css">
新闻热点
疑难解答
图片精选