viewport 640宽的做法 针对iphone和安卓单独设置

<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="utf-8" />
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="0">
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="pragram" content="no-cache" />

<base href="http://app.cntcma.com/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>第二届京津冀协同发展论坛</title><meta name="sharecontent" data-msg-img='http://app.cntcma.com/attachments/image/20141113/20141113205001_32033.png' data-msg-title='第二届京津冀协同发展论坛' data-msg-content='敬请关注' data-msg-callBack='' data-line-img='http://app.cntcma.com/attachments/image/20141113/20141113205001_32033.png' data-line-title='第二届京津冀协同发展论坛' data-line-callBack='' />
<script type="text/javascript">
if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
        var version = parseFloat(RegExp.$1);
        if(version>2.3){
            var phoneScale = parseInt(window.screen.width)/640;
            document.write('<meta name="viewport" content="width=640, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', target-densitydpi=device-dpi">');
        }else{
            document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
        }
    }else{
        document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
    }

//微信去掉下方刷新栏
    if(RegExp("MicroMessenger").test(navigator.userAgent)){
        document.addEventListener('WeixinJSBridgeReady', function() {
            WeixinJSBridge.call('hideToolbar');
        });
    }    
</script>

参考的页面:http://app.cntcma.com/wx/35f4a8d465e6e1edc05f3d8ab658c551.html

 

还看见一个鸡贼的东西 

width: 100%;
max-width: 600px;

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

这个更省事,都不用单独写viewport了

 

css动画里面播放完了,不在初始位置,而在最终位置的css规则为

-webkit-animation-fill-mode: both;
animation-fill-mode: both;

 

要想div高度100%,先得设置 html和body的高度100%

posted @ 2014-11-30 11:13  彭成刚  阅读(797)  评论(0编辑  收藏  举报