在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         width: 100vw;
12         border: none;
13     }
14 </style>
15 <div >>
16     <iframe >></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 }

 

相关文章:

  • 2021-11-23
  • 2021-08-19
  • 2021-10-30
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2022-02-08
相关资源
相似解决方案