zoukankan      html  css  js  c++  java
  • ios 不支持iframe 解决方案

    在iframe外层在包一层,通过appendChild()把内容增加到容器中,完整代码如下:

     1 @section Css
     2     {
     3     <link href="@ViewHelper.Content("/Content/css/mobiscroll.css")" rel="stylesheet" type="text/css" />
     4     <link href="@ViewHelper.Content("/Content/css/common.css")" rel="stylesheet" />
     5 }
     6 <style>
     7     .frame {
     8         margin-top: 55px;
     9         padding: 10px;
    10         height: 90vh;
    11          100vw;
    12         border: none;
    13     }
    14 </style>
    15 <div id="iframe-box">
    16     <iframe id="ifram" class="frame" width="420" height="330" src="@ViewBag.PathUrl.Replace("http://","https://")"></iframe>
    17 </div>
    18 @section Js{
    19     <script>
    20         var ifram = document.getElementById('ifram');
    21         if (navigator.userAgent.match(/iPad|iPhone/i)) {
    22             var iframe_box = document.getElementById('iframe-box');
    23             iframe_box.style.width = 100 + '%';
    24             iframe_box.style.overflowX = 'hidden';
    25             iframe_box.style.overflowY = 'scroll';
    26             iframe_box.style.webkitOverflowScrolling = 'touch';
    27             ifram.setAttribute('scrolling', 'no');
    28             iframe_box.appendChild(ifram);
    29         }
    30     </script>
    31 }
  • 相关阅读:
    node.js ---path模块
    es6箭头函数this问题
    Codeforces Round #576 (Div. 2) | CF1199 补题
    Hungary
    CF 1196D2 RGB Substring (hard version) --- 前缀和 + 思维
    康托展开
    POJ1821 Fence --- 单调队列 + DP
    素数筛
    自动化接口面试遇到的问题
    linux遇到的面试问题
  • 原文地址:https://www.cnblogs.com/CandyManPing/p/6886466.html
Copyright © 2011-2022 走看看