有关HTML5页面在iPhoneX适配问题

时间:2017-12-05

2.1 子元素页面固定在底部时;使用viewport-fit:cover时;可以看到bottom:0时只会显示在安全区域内;

有关HTML5页面在iPhoneX适配问题

添加html,body {width:100%;heigth:100%}

有关HTML5页面在iPhoneX适配问题

图1:

* {
           padding: 0;
           margin: 0;
       }
       html,body {
           height: 100%;
       }
       body {
           background: grey;
           padding-top: constant(safe-area-inset-top);
           padding-left: constant(safe-area-inset-left);
           padding-right: constant(safe-area-inset-right);
           padding-bottom: constant(safe-area-inset-bottom);
       }
       .top {
           width: 100%;
           height: 44px;
           background: purple;
       }
       .bottom {
           position: fixed;
           bottom: 0;
           left: 0;
           right: 0;
           height: 44px;
           color: black;
           background: green;
       }

图2:

* {
           padding: 0;
           margin: 0;
       }
       html,body {
           height: 100%;
       }
       body {
           background: grey;
           padding-top: constant(safe-area-inset-top);
           padding-left: constant(safe-area-inset-left);
           padding-right: constant(safe-area-inset-right);
           /*padding-bottom: constant(safe-area-inset-bottom);*/
       }
       .top {
           width: 100%;
           height: 44px;
           background: purple;
       }
       .bottom {
           position: fixed;
           bottom: 0;
           left: 0;
           right: 0;
           height: 44px;
           color: black;
           background: green;
       }

2.3 关于alertView弹框 遮罩层的解决方案

有关HTML5页面在iPhoneX适配问题

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <!--<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">-->
   <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
   <meta http-equiv="pragma" content="no-cache">
   <meta http-equiv="cache-control" content="no-cache">
   <meta http-equiv="expires" content="0">
   <title>alertView</title>
   <script data-res="eebbk">
       document.documentElement.style.fontSize = window.screen.width / 7.5 + 'px';
   </script>
   <style>
       * {
           margin: 0;
           padding: 0;
       }
       html,body {
           width: 100%;
           height: 100%;
       }
       body {
           font-size: 0.32rem;
           padding-top: constant(safe-area-inset-top);
           padding-left: constant(safe-area-inset-left);
           padding-right: constant(safe-area-inset-right);
           padding-bottom: constant(safe-area-inset-bottom);
       }
       .content {
           text-align: center;
       }
       .testBut {
           margin: 50px auto;
           width: 100px;
           height: 44px;
           border: 1px solid darkgray;
           outline:none;
           user-select: none;
           background-color: yellow;
       }
   </style>
   <link href="alertView.css" rel="stylesheet" type="text/css">
</head>
<body>
   <section class="content">
       <button class="testBut" onclick="showLoading()">弹框加载</button>
   </section>
   <script type="text/javascript" src="alertView.js"></script>
   <script>
       function showLoading() {
           UIAlertView.show({
               type:"input",
               title:"温馨提示",              //标题
               content:"VIP会员即将到期",     //获取新的
               isKnow:false
           });
           var xx = new UIAlertView();
          console.log(xx);
       }
   </script>
</body>
</html>

总结

  • 共4页:
  • 上一页
  • 3/4
  • 下一页
  • 上一篇:html5中canvas图表实现柱状图的示例 下一篇:没有了

    相关文章

    最新文章